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"; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: CSV_XS issue
by Tux (Canon) on Apr 07, 2013 at 10:04 UTC | |
by anaconda_wly (Scribe) on Apr 08, 2013 at 03:17 UTC | |
by Tux (Canon) on Apr 08, 2013 at 06:00 UTC | |
|
Re: CSV_XS issue
by Corion (Patriarch) on Apr 07, 2013 at 10:01 UTC | |
|
Re: CSV_XS issue
by talexb (Chancellor) on Apr 07, 2013 at 13:52 UTC | |
by anaconda_wly (Scribe) on Apr 08, 2013 at 03:25 UTC |