Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Problems with -filetest on readdir results

by atopolc (Pilgrim)
on May 24, 2002 at 03:11 UTC ( #168965=note: print w/replies, xml ) Need Help??


in reply to Problems with -filetest on readdir results

This is a great opportunity to use map especially if you are going to need the path again later in your script. From your code Untested:
#!/usr/bin/perl $path="."; opendir (DIR, $path) or die "could not open directory"; @files = map {"$path/$_"}, readdir(DIR); #maps the path into your arra +y foreach (@files) { print "$_ \n" if (-d $_) ; }
Update: Thanks merlyn

Replies are listed 'Best First'.
•Re: Problems with -filetest on readdir results
by merlyn (Sage) on May 24, 2002 at 03:14 UTC

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (2)
As of 2021-12-02 03:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (17 votes). Check out past polls.

    Notices?