in reply to READDIR - Sort by Time?
my @dirfiles = map $_->[0], sort { $a->[1] <=> $b->[1] } map [ $_, +(stat "$dirname/$_")[9] ], grep $_ ne '.' and $_ ne '..', readdir ORDERS;
Note that using a regex to filter out the . and .. here is overkill and even results in unexpected behaviour: the $ matches in front of a \n so the regex will also throw away files called ".\n" or "..\n".
Update: changed stat $_ (d'oh) into stat "$dirname/$_"
Makeshifts last the longest.
|
|---|