use strict; use warnings; use Data::Dumper; my %hoa; while (<DATA>) { my ($name, $num) = split; push @{$hoa{$name}}, $num; } print Dumper(\%hoa); __DATA__ DAVID 31 DAVID 29 DAVID 41
prints:
$VAR1 = { 'DAVID' => [ '31', '29', '41' ] };
In reply to Re: Howto deal with multiple Hash key values
by toolic
in thread Multiple Hash key values problem !!
by ashnator
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |