in reply to Re^2: Sorting an Array
in thread Sorting an Array

You could also use a date parsing module such as Date::Parse and do a Schwartzian Transform:

use Date::Parse; # ... my @statements = map { $_->[1] } sort { $a->[0] <=> $b->[0] } map { [ str2time($_->{'statement_date'}), $_ ] } @statements;

Other date-parsing modules that might be of interest include Date::Manip, HTTP::Date, and Time::ParseDate.

Replies are listed 'Best First'.
Re^4: Sorting an Array
by choroba (Cardinal) on Jul 31, 2014 at 17:22 UTC
    Or, you can use Time::Piece (core since 5.10) and Orcish Maneuver:
    my %cache; @sorted = sort { ( $cache{$a} //= 'Time::Piece'->strptime($a->{statement_date}, '%m +/%d/%Y') ) <=> ( $cache{$b} //= 'Time::Piece'->strptime($b->{statement_date}, '%m +/%d/%Y') ) } @statements;
    لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ