print join "\n", sort {-M $a <=> -M $b} @DirList;
This will result in a flood of stat calls. This would be more efficient:
print join "\n", map $_->[0], sort {$a->[1] <=> $b->[1]} map [$_, -M], @DirList;Plus, one might want to do something if -M returns undef (due to permission problems or broken symlinks).
Update: corrected my silly typing errors, thanks to GrandFather
In reply to Re^2: sorting a directories content
by betterworld
in thread sorting a directories content
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |