Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: Dumb or Cursed?

by choocroot (Friar)
on May 23, 2002 at 19:07 UTC ( #168881=note: print w/replies, xml ) Need Help??


in reply to Problems with -filetest on readdir results

The files you get from readdir are relative to your directory $path and -d test for files from the current directory.
So, you need to specify your path in the test :
use strict; my $path = "/usr/local/"; opendir( DIR, $path ) or die "could not open dir : $!\n"; my @files = readdir( DIR ); foreach my $file (@files) { print "$file\n" if( -d "$path/$file" ); }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://168881]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2022-05-25 19:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (90 votes). Check out past polls.

    Notices?