in reply to Re: Text::CSV_XS and blank lines
in thread Text::CSV_XS and blank lines
Would it help if I would add a feature that makes the number of fields parsed in the last line available?
Yes, it would indeed. With a field_count property, one could easily skip truly blank lines in the CSV file.
CSV_RECORD: while (my $value_of = $csv->getline_hr($csv_fh)) { next CSV_RECORD if $csv->{field_count} == 1; # ... }
This is more elegant than having to evaluate keys %value_of in a scalar context to determine the number of fields or, in the case of parse(), evaluating @values in a scalar context.
UPDATE: Erased the confused bit about evaluting keys %value_of in a scalar context, which wouldn't help.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Text::CSV_XS and blank lines
by Tux (Canon) on Feb 04, 2011 at 18:51 UTC | |
by Jim (Curate) on Feb 04, 2011 at 19:18 UTC |