in reply to Scanning directory for new files

Okay that code look good, just a couple of things I'd change...

Instead of looping until the last character of time is 0 you could simply put sleep(10); just before the redo, making your aim clearer overall (and safer, for example if there are few files the loop may repeat within the same second thus repeating the processing immediately).

Depending on how the files are written they may still be arriving when you process them. This is unlikely to be desireable so it would be better if you only process files if they have already been in existance for the previous loop or two. The methods of doing that are left as an exercise.

The use of substr (though in above paragraphs I suggest another solution) is better written as substr(time,-1)