Question: I am looking for search implementation on hash using perl. I have following data in my hash

```
%hash = {0 => "Hello", 1=> "world"}. 

```

Now i want to search the hash using the values (means world and hello) and return corresponding key.

Example: I want to search for world and the result should be 1

Answer: 
If:

1. The hash isn't very large, and
2. The values are unique

You can simply create a lookup hash with [`reverse`](http://perldoc.perl.org/functions/reverse.html):

```
my %lookup = reverse %hash;
my $key = $lookup{'world'}; # key from %hash or undef

```
```
use strict;
use warnings;

my %hash = (0 => "Hello", 1=> "world");
my $val = 'world';

my @keys = grep { $hash{$_} eq $val } keys %hash;

print "Keys: ", join(", ", @keys), "\n";

```

This will return all keys i.e. If the value is same for multiple keys.