in reply to Read through directory and return matched data
Would this happen to be (ick...) Microsoft Windows? ;-)
If so, then not only should you use File::Find, but you should also cache all of the filenames found, into an array, first. Then, go back and “run the list” of filenames that you just found.
The file-scanning primitives in Windows are easily flummoxed by any sort of file-operation that occurs in the meantime. Therefore, “search first, ask questions later.”