Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

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

by mrmick (Curate)
on Dec 10, 2000 at 20:14 UTC ( [id://45948]=note: print w/replies, xml ) Need Help??


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

You want to open the directory (handle) and read all filenames into an array using readdir. This will read all files (including . and .. into the array). From here you can use a foreach loop to iterate throught he array and do what you want:
my $directory = 'c:\windows'; opendir(DIR,$directory); my @files = readdir(DIR); closedir(DIR); foreach(@files){ print $_,"\n"; }
I hope this gets you going in the right direction...

Mick

Log In?
Username:
Password:

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

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

    No recent polls found