Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
I have the following code:
for my $line (@lines) { print "Line: $line\n"; if ($csv->parse($line)) { my @fields = $csv->fields(); my $i = 0; for my $column (@fields) { print ++$i, " = ", $column, "\n"; } print "\n"; } else { my $error = $csv->error_input(); print "parse() failed on argument: ", $error, "\n"; } }
This works fine when @lines contains the data in the format:
field1, field2, field3
But prints parse() failed on argument:(no $error value) for the following:
"field1", "field2", "field3"
The Text::CSV docs say "A field within CSV may be surrounded by double-quotes." So it would appear to me to be valid formatting. Could someone explain the error to me? Thanks.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Text::CSV field quoting problem
by steves (Curate) on Jun 23, 2003 at 02:01 UTC | |
by Anonymous Monk on Jun 23, 2003 at 03:21 UTC | |
|
Re: Text::CSV field quoting problem
by barbie (Deacon) on Jun 23, 2003 at 08:37 UTC |