use strict;
use warnings;
use DateTime;
my @sorted_dates = sort {
DateTime->compare_ignore_floating($$b{'submitted'}, $$a{'submitted'})
} map {
my ( $month, $day, $year ) = ( split( '/', $_ ) )[ 0 .. 2 ];
{
qq(submitted),
DateTime->new(
year => $year + 2000,
month => $month,
day => $day,
time_zone => 'Europe/Paris',
)
}
} qw{ 01/22/08 01/12/08 04/01/09 10/04/08 01/10/09 12/12/09 01/22/0
+9 01/12/09 12/30/08 12/22/08 12/15/08 01/05/09 01/19/09 01/21/09};
print $sorted_dates[$_]{'submitted'}->mdy('/'), "\n"
for 0 .. $#sorted_dates;
__END__
Output:
12/12/2009
04/01/2009
01/22/2009
01/21/2009
01/19/2009
01/12/2009
01/10/2009
01/05/2009
12/30/2008
12/22/2008
12/15/2008
10/04/2008
01/22/2008
01/12/2008
hth,
PooLpi