in reply to Find a filename in a text file

You are opening the file for append (">>") which is write only which means that you can't read from the LOG filehandle.

It would probably be better to use a tied hash instead.