On Tue, 13 Jan 2015 22:40:46 -0500
Brandon McCaig <[email protected]> wrote:
> my @files = map { $_->[0] }
> sort { $a cmp $b }
sort { $a->[1] <=> $b->[1] }
> map {[$_, (stat("$dir/$_"))[9] ] }
> grep { ! /^\./ && -f "$dir/$_" } readdir($dh);
$a and $b are ARRAY references. The `stat` is the second element, at
index 1.
You could also sort by name when the mtimes are the same:
sort { $a->[1] <=> $b->[1]
|| lc( $a->[0] ) cmp lc( $b->[0] ) }
--
Don't stop where the ink does.
Shawn
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/