in reply to Writing CSV files
The default behavior for Text::CSV_XS works as you want things to. Example:
produces:use strict; use Text::CSV_XS; use IO::File; my $csv = Text::CSV_XS->new(); my @row; while (<DATA>) { chomp; @row = split(/\|/, $_); $csv->print(\*STDOUT, \@row); print "\n"; } __DATA__ Field1|Field Number Two|Field Number Three|Field4 Another One|foo|fubar|foo and fubar
Field1,"Field Number Two","Field Number Three",Field4 "Another One",foo,fubar,"foo and fubar"
I've found Text::CSV_XS to be the most accurate at generating true CSV, versus just delimited by commas, which some people seem to think is CSV.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Writing CSV files
by tachyon (Chancellor) on Oct 29, 2004 at 12:03 UTC | |
by steves (Curate) on Oct 29, 2004 at 13:38 UTC |