These are the important changes:use strict; my $dir = "/"; my $file; sub openNewDir { my $dir = shift; my $dh; opendir ($dh, $dir); while ($file = readdir ($dh)) { next if (($file eq '.') || ($file eq '..')); if (-d "$dir/$file") { openNewDir("$dir/$file"); } else { # Do something with the file } } close ($dh); } openNewDir ($dir);
-Ton
-----
Be bloody, bold, and resolute; laugh to scorn
The power of man...
In reply to Re: Recursive opendir without
by ton
in thread Recursive opendir without
by bobione
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |