You might want to read the documentation of File::Find. It is a very useful module to traverse a directory structure. Basically you provide a subroutine and File::Find calls that subroutine for every file that it finds in a directory
Also it sets $_ to the path of every file. So in your example code "-d" tests if the filename in $_ is a directory. If not, the subroutine is exited prematurely through a hack. It really should be "return unless -d;". I suspect "next" works only because someone found out that in the File::Find module that calls your subroutine there is a loop which then starts the next iteration
Naturally you can use the subroutine to collect all files in a global array. But if you just want to do the same thing to all the files, do that something inside this subroutine and ignore all directories, i.e. use "return if -d;" instead.
In reply to Re: recursive subdirectories
by jethro
in thread recursive subdirectories
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |