[NTLUG:Discuss] A quick script anyone?
Victor Brilon
victor at victorland.com
Thu Jul 31 11:14:22 CDT 2008
On Jul 31, 2008, at 8:37 AM, Daniel Hauck wrote:
> Parsing a CSV file and generating some output.
>
> I have a list where the first field is a number and the next two are
> text fields. A line would look like this:
>
> 10, "US", "United States of America"
>
Parsing CSV is harder than it looks at first glance. Especially once
you consider things like commas embedded inside the quotes, or escaped
quotes inside quotes, and so forth.
My recommendation would be use Perl and the Class::CVS (http://search.cpan.org/~djr/Class-CSV-1.03/CSV.pm
) module to do all the heavy lifting for you.
Victor
More information about the Discuss
mailing list