use strict; use warnings; use Text::CSV_XS; my $csv = Text::CSV_XS->new(); # create a new object while (<DATA>) { my $status = $csv->parse($_); # parse a CSV string into fields my @columns = $csv->fields(); # get the parsed fields my $str = join '|', @columns; print "$str\n"; } __DATA__ a,b,c d,e,"f|g"
prints:
a|b|c d|e|f|g
Is this the output you are looking for?
In reply to Re: Replacing commas with pipes
by toolic
in thread Replacing commas with pipes
by joec_
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |