in reply to How to parse a csv file by comma, but ignore comma inside the single quotation

Besides the obvious that others already correctly posted, please have Text::CSV do the line-endings, not perl:

my $parser = Text::CSV->new ({ auto_diag => 1, quote_char => "'", allow_loose_quotes => 1, allow_loose_escapes => 1, allow_whitespace => 1, }); open my $fo, ">", $outfile or die "$outfile: $!\n"; open my $fh, "<", $file or die "$file: $!\n"; while (my $row = $csv->getline ($fh)) { print $fo (join "@" => $row->[0], $row->[1] . $row->[2], $row->[3], $row->[17], $row->[18], ), "\n"; }

Enjoy, Have FUN! H.Merijn
  • Comment on Re: How to parse a csv file by comma, but ignore comma inside the single quotation
  • Download Code