On Tue, 13 Jan 2015 22:40:46 -0500
Brandon McCaig <bamcc...@gmail.com> 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: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to