Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How do I read files from a folder and place them into a list?

by ctilmes (Vicar)
on Apr 22, 2003 at 15:38 UTC ( [id://252291]=note: print w/replies, xml ) Need Help??


in reply to How do I read files from a folder and place them into a list?

File::Slurp offers a shortcut for the opendir/readdir/closedir idiom:
use File::Slurp; my $dir = '.'; # or whatever my @files = sort grep { -f "$dir/$_" } read_dir($dir);
Note that File::Slurp::read_dir automatically skips '.' and '..'.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (6)
As of 2024-03-29 10:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found