in reply to mildly tricky hash question
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: mildly tricky hash question
by matija (Priest) on Mar 30, 2004 at 08:43 UTC | |
by Anonymous Monk on Mar 30, 2004 at 19:33 UTC |