Is it what you want?
use Data::Dumper; my $data = <<EOT; Row 1 label1 : item1 label2 : item1 Row 2 label1 : item2 label2 : item2 EOT push @{$hash{$1}}, $2 while $data =~ /(\S+)\s*:\s*(\S+)/g; print Dumper(\%hash);
$VAR1 = { 'label1' => [ 'item1', 'item2' ], 'label2' => [ 'item1', 'item2' ] };
In reply to Re: map to hash of arrays
by ccn
in thread map to hash of arrays
by emilford
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |