The script dies at my @names = readdir(DIR) or die "Unable to read current dir: $!\n"; closedir(DIR); with a "Bad file descriptor" error message.open(DIR, ".") or die "Can't open the current directory: $!\n"; my @names = readdir(DIR) or die "Unable to read current dir: $!\n"; closedir(DIR); foreach my $name (@names) { next if ($name eq "."); next if ($name eq ".."); if (-d $name) { print "found a directory: $name\n"; next; } if ($name eq 'core') { print "found 'core' file!\n"; } }
What does that mean?
Thanks.
In reply to Bad file descriptor by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |