in reply to processing a lot of files

What value have $f and $_ in these snippets?
The warnings are true, you have failed to allow for the changes to the operation of your loop.