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

Re: How do I read all the file names of a directory into an array?

by kilinrax (Deacon)
on Dec 10, 2000 at 17:02 UTC ( [id://45942]=note: print w/replies, xml ) Need Help??


in reply to How do I read all the file names of a directory into an array?

Use opendir, readdir and closedir.
Assuming you don't want '.' or '..' to appear in the list of filenames, the following is probably what you are looking for:
opendir DIR, "directory/"; my @files = grep { $_ ne '.' && $_ ne '..' } readdir DIR; closedir DIR;
  • Comment on Re: How do I read all the file names of a directory into an array?
  • Download Code

Log In?
Username:
Password:

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

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

    No recent polls found