in reply to Double quotes in CSV using Text::CSV
You don't show any relevant code, so I have to guess as to what you tried and what your expected output is.
My guess is that you want as output ,"", while Text::CSV in its standard configuration outputs ,, for an empty column. The documentation shows how to make Text::CSV always use quotes when creating a CSV line:
#!perl -w use strict; use Text::CSV; my $csv= Text::CSV->new({ binary => 1, eol => $/ }); my $csv_quoted= Text::CSV->new({ binary => 1, eol => $/, always_quote +=> 1 }); my @values= ('A string', 'A string with "double quotes"', '""', 'Now a +n empty string', '', '<< here'); $csv->print( \*STDOUT, \@values ); $csv_quoted->print( \*STDOUT, \@values ); __END__ "A string","A string with ""double quotes""","""""","Now an empty stri +ng",,"<< here" "A string","A string with ""double quotes""","""""","Now an empty stri +ng","","<< here"
|
|---|