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. :-)
In reply to Re: Parsing CSV into a hash
by dragonchild
in thread Parsing CSV into a hash
by McDarren
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |