in reply to Sort files descending by date

@sorted_list = sort { substr($a, 15) cmp substr($b, 15) } @file_list;
... probably as fast as the ST and much simpler!

Replies are listed 'Best First'.
Re^2: Sort files descending by date
by ikegami (Patriarch) on Jun 19, 2007 at 13:58 UTC

    Using the default sort handler should be even faster:

    my @sorted_list = map { substr($_, 23) } sort map { substr($_, 15, 23) . $_ } @file_list;

    Same thing, but uses very little overhead memory:

    my @sorted_list = @file_list; $_ = substr($_, 15, 23) . $_ for @sorted_list; @sorted_list = sort @sorted_list; $_ = substr($_, 23) for @sorted_list;