> -----Original Message-----
> From: richard noel fell [mailto:[EMAIL PROTECTED]]
> Subject: problem with directory listing
> 
> Below is sample code that does not work as I intend, the 
> intention being
> to list all the sub-directories in a given directory.
> 
> #!/usr/local/ActivePerl-5.6/bin/perl5.6.1 -w
> 
> use strict;
> my $mw;
> my $menubar;
> my $algebra;
> my @file_array;
> 
> my $dir_to_process = "/home/rfell/mathprogram";
> opendir DH, $dir_to_process or die "cannot open $dir_to_process: $!";
> foreach my $file (@file_array=readdir DH){
> if( -d $file){
> print "$file is a sub-directory of $dir_to_process \n";
> }
> }
> closedir DH;
> 
> The  problem is that only . and .. are listed. No other 
> sub-directories,
> which are in fact there, are listed. I surely am missing something
> simple here. Can anyone enlighten me?
> Thanks, 
> Dick Fell

I tested this on Win2k, ActiveState Perl 5.6.1, build 631, and had a similar
problem.  I did some further testing and got some interesting results.  Here
is what I found:

When run from c:\home\rfell\mathprogram, it showed all the directories.

When run from the root of C:\, it showed ., .., and the first subdirectory I
created.

When run from c:\home, it showed only . and .. as directories.

When run from a network drive, it showed only . and .. as directories.

All the subdirectories ARE listed in the array, but somehow the file test
descriptor is not being applied correctly or something.  I haven't looked on
ActiveState's site to see if this has been reported previously, but it seems
as though it definitely merits further investigation (or a better
explanation of why this is happening).

Hope this helps...
Jason


CONFIDENTIALITY NOTICE:

************************************************************************

The information contained in this ELECTRONIC MAIL transmission
is confidential.  It may also be privileged work product or proprietary
information. This information is intended for the exclusive use of the
addressee(s).  If you are not the intended recipient, you are hereby
notified that any use, disclosure, dissemination, distribution [other
than to the addressee(s)], copying or taking of any action because
of this information is strictly prohibited.

************************************************************************

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to