ON 20010424@2:04:30 PM at page: http://192.168.0.5/techref/language/perl/index.htm JMN-EFP-786 James Newton added 'See also: http://192.168.0.5/techref/language/perl/opendir.htm ' ON 20010424@2:05:45 PM at page: http://192.168.0.5/techref/language/perl/opendir.htm JMN-EFP-786 James Newton added 'Says To check for all the subdirectories in a directory, try code like this:
$path = shift;
$path = "." unless $path;
opendir( DIR, $path )
or die "Can't open $path: $!";
while ( $entry = readdir( DIR ) ) {
$type = ( -d "$path\\$entry" ) ? "dir" : "file"; # $path is crucial!
print "$type\t$entry\n";
}
closedir( DIR );
It's a common mistake to leave out the $path from the -d check. If you do this, perl thinks you're talking about files in the current directory. Since the dirs don't -e in your current directory, they definitely don't -d. Exceptions are . and .., which exist in every directory.
'
ON 20010424@2:06:31 PM at page:
http://192.168.0.5/techref/language/perl/condition.htm
JMN-EFP-786 James Newton added 'See also:
opendir.htm
'
ON 20010425@4:41:51 PM at page:
http://192.168.0.5/techref/language/perl/win32.htm
JMN-EFP-786 James Newton added 'See also:
http://www.activestate.com/ASPN/Perl/
The Perl for Windows'Connection to host failed.
ON 20010426@8:46:52 AM at page:
http://192.168.0.5/techref/language/perl/win32.htm
JMN-EFP-786 James Newton added 'Says
In config.pl (which is designed to fix the path names in config.pm after a "binary" install) the methods used to figure out what path perl is now in don't seem to work on NT. $0 returns only the executable name, shift returns nothing. I changed the reference to $0 into $^X and that seemed to solve the problem.'