Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
Hi monks. I want to make a program that reads a directory looking for subdirectories. It look like this :
opendir($dh,"C:/"); while($var = readdir($dh)){ if(-d $var){ print "$var\n"; } } close $fh;
I was expecting to get a list with the foldernames Can someone explain why this example is not working? According to a source on the internet this looks ok, hope you can help me. tx.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: read directory
by choroba (Cardinal) on Dec 20, 2017 at 15:32 UTC | |
by Anonymous Monk on Dec 20, 2017 at 15:49 UTC | |
by choroba (Cardinal) on Dec 20, 2017 at 15:55 UTC | |
by Anonymous Monk on Dec 20, 2017 at 16:10 UTC | |
|
Re: read directory
by hippo (Archbishop) on Dec 20, 2017 at 16:07 UTC | |
by Anonymous Monk on Dec 20, 2017 at 16:38 UTC | |
by hippo (Archbishop) on Dec 20, 2017 at 16:46 UTC | |
|
Re: read directory (readdir is raw eggs)
by Anonymous Monk on Dec 21, 2017 at 01:19 UTC |