Or with Text::CSV/Text::CSV_XS:
use warnings; use strict; use Data::Dump; use Text::CSV; # also install Text::CSV_XS for speed my %data; my $csv = Text::CSV->new({ binary=>1, auto_diag=>2, sep_char=>"|", allow_whitespace=>1 }); my $hdr = $csv->getline(*DATA); while ( my $row = $csv->getline(*DATA) ) { push @{ $data{ $row->[0] } }, $row->[1]; } $csv->eof or $csv->error_diag; dd \%data; __DATA__ ColA | ColB | 500001| Network1| 500001| Network2| 500002| Network2| 500003| Network1| 500003| Network3|
In reply to Re^2: Need to get hash of arrays
by haukex
in thread Need to get hash of arrays
by chandantul
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |