in reply to Parsing CSV into a hash
use Text::xSV; my $parser = Text::xSV->new; $parser->open_file( $datafile ); my @headers = $parser->read_header; shift @headers; # Remove the # field. my $user_header = shift @headers; my $data; while ( $parser->get_row ) { my $user = $parser->extract( $user_header ); $data->{ $user }{ @headers } = [ $parser->extract( @headers ) ]; }
Update: Obviously, use tilly's corrections to my suggestion as he wrote the module in question. Plus, he's right. :-)
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Parsing CSV into a hash
by tilly (Archbishop) on Sep 20, 2005 at 08:00 UTC |