in reply to Getting the keys of identical values in a hash

My first inclination is to use arrays, as Zaxo did above. But I think maybe hashes would be easier:
my %ih; $ih{$hash{$_}}{$_}++ for keys %hash; print for grep { keys %{$ih{$_}} > 1 } keys %ih;
I also think a while/each might be nice here, as it makes the inversion of the hash a bit clearer:
while ( my($key,$val) = each %hash ) { $ih{$val}{$key}++; }

Replies are listed 'Best First'.
Re^2: Getting the keys of identical values in a hash
by knsridhar (Scribe) on Sep 15, 2005 at 09:08 UTC

    Thanks a lot for all your suggestions.It worked fine

    Thanks