one way to handle commas in quotes strings in CSV files -- of course
if your data has angle brackets in it, or form feeds, you'll need a
different three characters.

while (<>){

     while (/"/){
        m/[<>\f]/ and die "ANGLE BRACKET OR FF IN INPUT! [$_]";
        s/"/</; s/"/>/ or die "unpaired quotes in [$_]";
        1 while s/<(.*?),(.*?)>/<$1\f$2>/;
        s/[<>]//g;
     };
     my @line = split ',',$_;
     s/\f/,/g for @line;

     ...


};


-- 
"During his first performance of the song he received one of the
highest honors you can achieve in New York’s underground rap scene:
audience members touched his sneakers after a few of the more
particularly tight lines."  -- Cal Newport
_______________________________________________
kc mailing list
[email protected]
http://mail.pm.org/mailman/listinfo/kc

Reply via email to