in reply to Re: How to get Keys from hash having same value?
in thread How to get Keys from hash having same value?
Or, to avoid the extra hash lookups, iterate over key-value pairs using each.
my @as = (); while (my ($key, $value) = each %myhash){ push @as, $key if $value eq 'a'; }
Update:
Is there a monk among us who can shorten this into a one-liner, similar to the grep keys examples we have seen?
It seems that each does not combine nicely with grep, map and their ilk.
In Section
Seekers of Perl Wisdom