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

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

Reply via email to