in reply to Re^2: sort based on date
in thread sort based on date

grep? What are you trying to filter out?

Anyway, the following manipulations are twice as fast:

my %month_key_lookup = ( 'Jan' => 'a', 'Feb' => 'b', ... 'Dec' => 'l', ); my @sorted_dates = map substr($_, 12), sort map { /^(.{3}) (\d?)(. .*)/s; $month_key_lookup{$1}.($2||'0').$3.$_ } @dates;

As a bonus, it doesn't clobber the contents of @dates.

Replies are listed 'Best First'.
Re^4: sort based on date
by Anonymous Monk on Aug 09, 2010 at 11:15 UTC

    This was an idea, without knowing author's intentions (does he want to preserve the initial @dates or no, etc.) and without searching for the fastest combination of possibilities.

    Of course your exemple is better, it runs in ~65 microseconds on my system (compared to ~105 microseconds used by mine and ~20000 microseconds used by author's code). Anyway, TIMTOWTDI :)