in reply to recursive dir and file
When you're recursing, you're passing the name of the subdirectory, but not the full path to it. You either need to concatenate it to the original directory path, or you need to chdir into and out of the subdirectory.
A better alternative may be to use File::Find or File::Find::Rule if those are available to you. Let them manage your recursion and spend your energy writing the code for what you actually want to do with each file.
-xdg
Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.
|
|---|