This may be a situation where you're forced to forgo the use of the convenience function, getline_hr, and roll your own code to generate a hash of the field values keyed by field labels. I do this a lot myself because I'm forced to use a version of Text::CSV_XS that predates the introduction of getline_hr.
my $value_of; $csv->parse(); @value_of{ @ordered_field_labels } = $csv->fields();
Typically, I get the ordered field labels from the CSV file header.
my @ordered_field_labels; while (my $csv_record = <>) { $csv->parse($csv_record); my @values = $csv->fields(); if ($INPUT_LINE_NUMBER == 1) { @ordered_field_labels = @values; # ... } # ... }
It's not inelegant. It's just a little less convenient.
(The blank lines are outside any quoted strings, right? They're not literal blank lines within fields are they?)
In reply to Re: Text::CSV_XS and blank lines
by Jim
in thread Text::CSV_XS and blank lines
by constantreader
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |