in reply to Re: Bad file descriptor error
in thread Bad file descriptor error
sub getdir { my $dir = shift; # Open the directory handle, reporting the reason ($!) opendir (my $dh, $dir) || die qq(Cannot opendir: $dir: $!); while( my $file = readdir($dh)) { next if ($file =~ m[^\.{1,2}$]); # Ignore . and .. my $path = $dir .'/'. $file; if (-e $path) { # do some stuff } elsif (-d $path) { getdir($path); } closedir ($dh); # Close the directory handle - OOPS } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Bad file descriptor error
by jethro (Monsignor) on Mar 22, 2010 at 11:51 UTC | |
by Lamont85 (Novice) on Mar 22, 2010 at 20:57 UTC |