Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Problems with -filetest on readdir results

by atopolc (Pilgrim)
on May 24, 2002 at 03:11 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2024-04-25 05:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found