use strict; use warnings; my %data; while (<DATA>) { chomp; my ($k, $v) = split; push @{$data{$k}}, $v; } use Data::Dumper; print Dumper(\%data); __DATA__ 1 A 1 B 2 B 4 X 5 V
In reply to Re: Perl hashes: is there some way of adding more data to the value associated with an existing key?
by wind
in thread Perl hashes: is there some way of adding more data to the value associated with an existing key?
by mertserger
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |