aquinom has asked for the wisdom of the Perl Monks concerning the following question:
I wrote a basic directory parser and my system refuses to output the contents using the -d check, although without using it everything gets output. So I'm sort of at a loss. I'll post the code, just so you can see I'm not crazy.
My question is, does anyone have any idea what would be causing this? ls -d does the same thing, it only reports that ". and .." are directories.
edit: actually my last observation that I added (without thinking about what I was writing) clearly demonstrates that this is a system thing and nothing to do with Perl. Best.
my $dir = "/"; opendir(DH, $dir) or die "Couldn't open directory: $dir"; while(my $line = readdir(DH)){ chomp $line; if ($line =~ /^\./){ next; } elsif (-d $line){ print "$line\n"; } } close(DH);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Listing directory contents not working (SUSE Linux issue?)...
by choroba (Cardinal) on Apr 09, 2013 at 19:45 UTC | |
by aquinom (Sexton) on Apr 09, 2013 at 19:57 UTC | |
by andal (Hermit) on Apr 10, 2013 at 06:18 UTC | |
|
Re: Listing directory contents not working (SUSE Linux issue?)...
by Anonymous Monk on Apr 10, 2013 at 07:58 UTC |