While replying to above Anonymonk I am actually clarifying to OP
But I don't see how(in example) typing in the "2" would pull up both BBB AND EEE
The possibly missing information is the syntax used above to treat the hash value - spelled out $hash{$key} - as if it were a plain array is to put it inside this thingy @{ ... } instead of the dots.
You have been shown that it gets into the hash value with the simple push function.
Getting stuff out works the same way:
foreach my $key ( keys %hash ) { foreach my $value ( @{ $hash{$key} } ) { print $key, ": ",$value, "\n" # or whatever you want to do. } }
Cheers, Sören
Créateur des bugs mobiles - let loose once, run everywhere.
(hooked on the Perl Programming language)
In reply to Re^2: duplicate keys on hash
by Happy-the-monk
in thread duplicate keys on hash
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |