in reply to Simple search and replace trouble!!
use Text::CSV; use strict; my $csv = Text::CSV->new({eol => "\n"}) or die "Cannot use CSV: ".Text::CSV->error_diag (); # Open your own files here my $fh = \*DATA; my $out = \*STDOUT; while (my $row = $csv->getline($fh)) { # Translate Name $row->[2] =~ s/(.*?),\s*(.*)/$2 $1/; $csv->print($out, $row); } __DATA__ -###.####,##.###,"Doe, John & Jane","### Main St","Town, State 13370", +,, -###.####,##.###,"Doe, John","### Main St","Town, State 13370",,,
|
|---|