in reply to Looping through a file to find a hash key

I'm sure there is a better way of doing this. What am I missing?

add use re 'debug'; and you'll see that  keys %hash_name doesn't make a very good pattern.

You can use  my $keys = join '|', map {"\Q$_\E"} keys %words; but simply iterating over the has might be faster