Your skill will accomplish what the force of many cannot |
|
PerlMonks |
Re: How do I read all the file names of a directory into an array?by mirod (Canon) |
on Dec 10, 2000 at 14:31 UTC ( [id://45937]=note: print w/replies, xml ) | Need Help?? |
Use the directory functions: opendir, closedir and readdir.
This will neatly put the list of file names in the @file array (with no \n at the end of each file name). There is a couple of other things you can improve in your code BTW:
Finally I have no idea why $filename$i =~ s/\*//g; is there? Is there a chance you that you might find a '*' in filenames?
In Section
Seekers of Perl Wisdom
|
|