in reply to open, chomp, create AND sort ?
Anyway, for an ST, you can presort your list of files with the following:
my @sorted = map { $_->[0]} sort { $b->[1] <=> $a->[1] } map { [ $_, (stat $_)[9] ] } @allfiles;
An Orcish Maneuver would be like the following:
There are probably other ways to do this, and I'm not quite sure how efficient either of these would be, but these are the only two that popped into my head. HTH.my %h; foreach $file (sort { ($h{$a} ||= (stat $a)[9]) <=> ($h{$b} ||= (stat $b)[9]) } @allfiles) { ...;
--
There are 10 kinds of people -- those that understand binary, and those that don't.
|
|---|