It seems shorter (if you ignore/eliminate the makeup I added to enhance readability) and much simpler than what you have and works. Hope this helps.sub browse($) { my $path = $_[0]; #append a / if missing if($path !~ /\/$/) { $path .= '/'; } #loop through the files contained in the directory for my $eachFile (glob($path.'*')) { #if the file is a directory if(-d $eachFile) { #browse directory recursively browse($eachFile); } else { your file processing here } } }#browse
In reply to Re: Traversing directories recursively
by RaduH
in thread Traversing directories recursively
by jesuashok
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |