Did something similar years ago --- so...
#!\user\bin\perl -w
while (@a_Field=GetCSV(@a_Field)) {
print join(' | ',@a_Field)."\n\n";
};
sub GetCSV{
my($s_Line,$s_Text);
while ($s_Line=<DATA>) {
#print "'$s_Line'\n";
my(@a_Field);
$s_Text.=$s_Line;
while ($s_Text =~ m{([^",]*)([,\n])|"((?:[^"]|"")*)"([,\n])}gs)
+{
unless (substr($`,-1,1) eq '"') {
if (defined $1) {
push(@a_Field,$1);
if ($2 eq "\n") {
return @a_Field;
};
} else {
my($s_Field);
($s_Field=$3)=~s/""/"/g;
push(@a_Field,$s_Field);
if ($4 eq "\n") {
return @a_Field;
};
};
};
};
};
return ();
};
__DATA__
10915,"S","Phil","ing Valley Middle School",$0.00,0,,0
10916,"Tr","Ny",,,,,,"999-999-9999",,,,"715000 works at Re-Max
Wishing for housecoat with dogs, no luck",$0.00,0,,0
10917,"Ro","Ox","3677 As Dr","W","BC","V4T 2W5",,"1111111111",,,,,$0.0
+0,0,,0
10918,"Sa","Fri",,"K","BC",,,"2222222222",,,,,$0.00,0,,0
10355,"Val","Woj",,,,,,"3333333333",,,,"Solutions",$0.00,0,,0
10356,"Ter","Bes",,,,,,"1211211212",,,,,$0.00,0,,0
10357,"Phi","Har",,,,,,"1231231234",,,,"6 Woodcroft Ave
St Catns
x1x1x1
999-999-3203
check the address to see if it is still her's.",$0.00,0,,0
10358,"Ra","Gak",,"Kel",,,,"3453453456",,,,,$0.00,0,,0
10359,"J","Ru",,"V","BC",,,"7777777777",,,,"st ing to tell J to come a
+gain…
(555) 899-9999",$0.00,0,,0
10360,"Li","Sa",,"Win",,,,"4444444444",,,,"LDr Claremont",$0.00,0,,0
10361,"Ke","Ta",,"K","BC",,,"5555555555",,,,,$0.00,0,,0
10362,"Kat","son",,"V","BC",,,"6666666666",,,,,$0.00,0,,0