| Refresh | Home EGTry.com

sort file by file modification time


my @files=glob("*.png");


my @orderFile=sort {
 my @timeA=stat($a);
 my @timeB=stat($b);
 return $timeA[9] <=> $timeB[9];
} @files;

print "before sort:\n", join("\n", @files), "\n";
print "after sort:\n", join("\n", @orderFile), "\n";