Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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 ( #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? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2022-05-22 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you prefer to work remotely?



    Results (80 votes). Check out past polls.

    Notices?