in reply to Replacing commas with pipes
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Replacing commas with pipes
by JavaFan (Canon) on May 11, 2009 at 19:32 UTC | |
by ww (Archbishop) on May 11, 2009 at 19:48 UTC |