Right, but I didn't see that as a requirement from the OP.
I would replace calls to opendir,readdir with a call to File::Find
This is an interesting point because I've never needed to use File::Find before. Just out of curiosity, why is File::Find better than Perl's own opendir & readdir?
Update: Should have phrased the question slightly better. I meant to ask why File::Find would be better than opendir & readdir for reading files from a directory bearing in mind that recursing through a directory was not a requirement.