@array = ('A','B','C','D'); for (@array) { $hash{$_} = undef; } #now we have the same hash as in the previous example. #so, you can do this repeatedly with out a hit: $foo = 'D'; if (exists $hash{$foo}) { print "There was a $foo in the array\n"; }