If you use the glob function, instead of readdir, you'll get the file names with the path that you used to search them. The readdir function returns only the file names, without the path.
Comment on Re: Perl script does not work on other directories?