You are completely right, and there is no easier way to do it
use Text::CSV_XS;
my $csv = Text::CSV_XS->new ({
binary => 1,
auto_diag => 1,
keep_meta_info => 1,
});
my $file = $ARGV[0] or die "Need to get CSV file on the command line\n
+";
my $sum = 0;
open my $data, "<", $file or die "Could not open '$file' $!\n";
while (my $row = $csv->getline ($data)) {
foreach my $idx (0 .. $#row) {
$csv->is_quoted ($idx) or next;
$row->[$idx] =~ s/(.*)/"$1"/; # TIMTOWTDI
}
# @$row is now quoted as you want
}
close $data;
Enjoy, Have FUN! H.Merijn
|