This baby puts the last four files modified most recently in the current directory into the array @files. If you want to select a directory, whack in a chdir() before you call the subroutine. I then print the name of each file in the array for your info.sub get_files { @files = reverse (map { (split (/\s+/))[8]; } `ls -lrt`); foreach $filename (@files[0..3]) { print "$filename\n"; } }
In reply to Re: How can I create an array of filenames?
by azatoth
in thread How can I create an array of filenames?
by vonman
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |