Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
the problem is, readdir() doesn't return any results. the directories I enter are full of files, when i run the debugger, $dir is indeed a perfectly fine directory path, and it works fine when i put a static path in opendir() instead of $dir (such as "c:\\windows\\mycrap"). i can't understand why it isn't working. And i'm not using strict or anything.$dir = <>; # get directory from STDIN $dir =~ s/\//\\/g; # clean up the path a bit opendir(DIR,"$dir"); # open directory $dir @files = readdir(DIR); # read directory contents into @files closedir(DIR);
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Can't seem to see the problem here...
by lemming (Priest) on Sep 13, 2001 at 04:07 UTC | |
|
Re: Can't seem to see the problem here...
by princepawn (Parson) on Sep 13, 2001 at 03:42 UTC | |
|
Re: Can't seem to see the problem here...
by clintp (Curate) on Sep 13, 2001 at 04:25 UTC | |
|
Re: Can't seem to see the problem here...
by grinder (Bishop) on Sep 13, 2001 at 15:42 UTC | |
|
Re: Can't seem to see the problem here...
by ducky (Scribe) on Sep 13, 2001 at 11:46 UTC |