in reply to Re: Help parsing a complicated csv
in thread Help parsing a complicated csv
I didn't even spot the change in field numbers in the OP! If that is a real criterium:
my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1}); my @hdr; while (my $row = $csv->getline ($fh)) { # example: if ( # a change in number of columns @hdr != @$row or # first column matches header criterium $row->[0] =~ m/^[A-Z]/ ) { @hdr = @{$row}; next; } # just an example my %hash; @hash{@hdr} = @$row; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Help parsing a complicated csv
by rmfin730 (Initiate) on May 13, 2011 at 21:32 UTC | |
|
Re^3: Help parsing a complicated csv
by rmfin730 (Initiate) on May 16, 2011 at 14:23 UTC | |
by linuxer (Curate) on Jul 05, 2011 at 21:32 UTC |