in reply to Hash/file --> doesn't seem to work

If your file is small go with the advice of reading it into memory as given above.

If that is unpractical read one line and iterate over the hash for each line. I.e. switch the two loops. This can be costly as well if the hash is big.