my %reverse_hash; foreach my $key ( keys %hash ) { push @{$reverse_hash{$hash{$key}}, $key; }
Or maybe a little clearer:
my %reverse_hash; while ( my ( $key, $value ) = each %hash ) { push @{$reverse_hash{$value}}, $key; }
Dave
In reply to Re: mildly tricky hash question
by davido
in thread mildly tricky hash question
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |