in reply to (tye)Re: Recursive opendir without
in thread Recursive opendir without
(I comment important lines).use strict; # ---> IMPORTANT my $dir = "toto"; my $file; sub openNewDir { my $dir = shift; ### my $dh; opendir ($dir, $dir); # ---> MODIFICATION while ($file = readdir ($dir)) { # ---> MODIFICATION here too next if (($file eq '.') || ($file eq '..')); if (-d "$dir/$file") { openNewDir("$dir/$file"); } else { # Do something with the file print "($file)\n"; } } close ($dir); # ---> MODIFICATION here too } openNewDir ($dir);
|
---|
Replies are listed 'Best First'. | |
---|---|
Re (tilly) 3: Recursive opendir without
by tilly (Archbishop) on Apr 12, 2001 at 06:04 UTC | |
by bobione (Pilgrim) on Apr 12, 2001 at 15:28 UTC |