#!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 an empty string', '', '<< here'); $csv->print( \*STDOUT, \@values ); $csv_quoted->print( \*STDOUT, \@values ); __END__ "A string","A string with ""double quotes""","""""","Now an empty string",,"<< here" "A string","A string with ""double quotes""","""""","Now an empty string","","<< here"