Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

( #357302=categorized answer: print w/ replies, xml ) Need Help??

Q&A > arrays > How do I read files from a folder and place them into a list? contributed by Anonymous Monk

opendir DIR, $dir or die "error: cannot open directory \"$dir\" $!"; @files = sort grep (!/^\.$|^\.\.$/, readdir(DIR)); closedir (DIR);

Comment on Answer: How do I read files from a folder and place them into a list?
Download Code
Re: Answer: How do I read files from a folder and place them into a list?
by cLive ;-) (Parson) on May 29, 2004 at 05:17 UTC
    Simplified:
    @files = sort grep (!/^\.\.?$/, readdir(DIR));
    cLive ;-)
Log In?
Username:
Password:

What's my password?
Create A New User
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (17)
As of 2015-07-06 17:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (77 votes), past polls