in reply to Need efficient way to fetch 20 last modified files from folder

chomp(my @newest = (`dir /A-D /O-D /D`)[5 .. 24]); # lines 0 - 4 - hea +der say for @newest;
If for Windows only, the switches,

/A-D files only /O-D ordered from newest to oldest /D output in column

Don't know if this will be faster for you. Type help dir at your command prompt.