Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

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

by chromatic (Archbishop)
on May 10, 2001 at 00:34 UTC ( [id://79241]=note: print w/replies, xml ) Need Help??


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

Open the directory with opendir, then call sort on your readdir. You might want to use file tests -X to see if you have only files.

Something like the following may work:

opendir DIR, $dir or die "Can't open $dir: $!"; my @files = sort grep { -f "$dir/$_" } readdir DIR; # work with @files

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (2)
As of 2024-04-26 05:03 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found