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

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

by Anonymous Monk
on May 28, 2004 at 17:15 UTC ( #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? - Answer 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
Replies are listed 'Best First'.
Re: Answer: How do I read files from a folder and place them into a list?
by cLive ;-) (Prior) 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 all is quiet...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (7)
As of 2017-06-28 16:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (640 votes). Check out past polls.