⭐ in reply to Get the Key corresponding to any given value
my %rhash = reverse %hash; my $key = $rhash{$value};
will give you the key for a given value.
If you might have duplicate values, grep is your friend:
If your values are numeric, use "==" instead of eq.my @keys = grep { $hash{$_} eq $value } keys %hash;
|
|---|