in reply to Re^2: readdir missing one file
in thread readdir missing one file
close doesn't work on directory handles. You need closedir .
You'll stop iterating prematurely if you have a file named 0 (zero). You need to check if the result of readdir is defined. Check if it's false isn't good enough.
Why are you using a global variable for the directory handle?
It's so easy to check opendir for errors, it's a very likely candidate for errors. Add a check!
my $Tdir_qfn = "/var/www/campbell/campbell.edu/www/content/2/"; opendir(my $Tdir_dh, $Tdir_qfn) or die("Can't read dir \"$Tdir_qfn\": $!\n"); while (defined( my $f = readdir($Tdir_dh) )) { print "<li>$f\n"; } closedir($Tdir_dh);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: readdir missing one file
by JavaFan (Canon) on Oct 17, 2008 at 17:26 UTC | |
by blazar (Canon) on Oct 18, 2008 at 12:18 UTC |