in reply to iterating through a hash?

shmem is right about how you should open the second file only once, and as other sub-replies there point out, just one hash is enough to do everything you want.

After you read the first file into a hash, you read each line of the second file, but instead of storing this, you check if each name exists in the hash; if so, print "OK" or "WRONG" according to whether the values match and then delete that hash element. When done reading the second file, any remaining hash elements are names in file1 that were not in file2 -- so that is where you iterate through the hash, to print those out at the end.