Whitespace, whitespace, whitespace. Right, got that over with now let's look at your code (formatted so it's readable)
#!/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 "$dir_to_process/$file" ) { # You need to append the original directory to the file from readir here print "$file is a sub-directory of $dir_to_process \n"; } } closedir DH; HTH John -----Original Message----- From: richard noel fell [mailto:[EMAIL PROTECTED]] Sent: 11 April 2002 13:07 To: [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 -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] --------------------------Confidentiality--------------------------. This E-mail is confidential. It should not be read, copied, disclosed or used by any person other than the intended recipient. Unauthorised use, disclosure or copying by whatever medium is strictly prohibited and may be unlawful. If you have received this E-mail in error please contact the sender immediately and delete the E-mail from your system. -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]