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

Haven't tried it out, but I think this would sort them.
@statements = sort by_date @statements; sub by_date { my $dateA = $a->{statement_date}; my $dateB = $b->{statement_date}; $dateA =~ s!(\d\d)/(\d\d)/(\d\d\d\d)!$3$1$2!; $dateB =~ s!(\d\d)/(\d\d)/(\d\d\d\d)!$3$1$2!; $dateA cmp $dateB; }

Replies are listed 'Best First'.
Re^3: Sorting an Array
by AppleFritter (Vicar) on Jul 31, 2014 at 17:04 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;
      لսႽ† ᥲᥒ⚪⟊Ⴙᘓᖇ Ꮅᘓᖇ⎱ Ⴙᥲ𝇋ƙᘓᖇ