--- Chris Knipe <[EMAIL PROTECTED]> wrote: > I have a MS Excel exported CSV text file, with , separated values. > The problem now, is that some of the values also contains a , > character, and MS Excel thus put the values in a quote such as: > "blah, blah", blah, "blah, blah, blah"
Try this: open(FILE, "<CC.csv"); while (<FILE>) { s/"([^",]+),([^",]+)"/$1$;$2/g; # replace embedded commas w/subsep s/,/\t/g; # replace field seperator commas with tabs s/$;/,/g # put the embedded commas back my ($CK, $NAME, $ADDRESS, $TYPE) = split('\t', $_); } Somebody reality check me on using $; there, ok? I've used fabricated strings like "\f\a\b\0" which are pretty darned unlikely, but if $; is reasonable it makes more sense. (c.f. perldoc perlvar for $;) __________________________________________________ Do you Yahoo!? Yahoo! Tax Center - forms, calculators, tips, more http://taxes.yahoo.com/ -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]