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:
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;
|
---|
In Section
Seekers of Perl Wisdom