http://www.perlmonks.org?node_id=1027345

anaconda_wly has asked for the wisdom of the Perl Monks concerning the following question:

code as below: my row1 and row2 were printed on the same line when I opened the csv file, not in TWO ROW as I expected, why? Thanks for help

use Text::CSV_XS; my ($csv, $fh); &main; sub main { my @row1 = ("aaa","fff","sss" ); my @row2 = ("bbb","fff","sss"); $csv = Text::CSV_XS->new ( { binary => 1 } ) # should set binary att +ribute. or die "Cannot use CSV: ".Text::CSV->error_diag (); open $fh, ">:encoding(utf8)", "new.csv" or die "new.csv: $!"; $csv->print ($fh, \@row1); $csv->print ($fh, \@row2); close $fh or die "new.csv: $!"; print " finished \n"; }