in reply to Ix::Hash with repeated keys
Try it and see what happens - if it doesn't work, you might want to take another look at what you're doing and see if you can do whatever you're trying to do. Perhaps maintain a seperate count every time you add\delete a value.use strict; use Tie::DxHash; my %foo; tie %foo, 'Tie::DxHash'; %foo = qw ( one 1.2 one 1.6 one 1.9 two 2 three 3 ); my @keys = keys %foo; print "@keys\n"; # if @keys only has each key once, try this: foreach my $key (@keys) { print "$key, " foreach ($foo{$key}) }
Look into perldsc anyway because I think this is best method.%hash = ( one => [1.2, 1.6, 1.9], two => [2], three => [3]);
|
|---|