On Mon, Feb 11, 2002 at 09:23:09PM -0500, Steven Arbitman wrote: > I know parsing a comma-separated value file should be easy: > @array = split /,/; # just split the line on commas > > However, my input csv file looks like this: > Name,"street,city,state,zip",phone,email,"comments, may have commas, 2" > > Note, not all fields have quotes, only those which contain commas have > quotes.
Parsing CSV formats, especially considering some of the hacks put in place to quote commas and quote quotes, can become fairly non-trivial, and easy to mess up. I would suggest using Text::CSV, Text::CSV_XS, or DBD::CSV, all of which are available from CPAN. Michael -- Administrator www.shoebox.net Programmer, System Administrator www.gallanttech.com -- -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
