http://www.perlmonks.org?node_id=511392


in reply to Sorting Dates

If you want to go with your original approach, the following maybe useful:

my @dates = qw(5/7/2001 3/10/2005 1/1/1996 2/1/1993); foreach my $date (@dates) { if ($date =~ m|(\d{1,2})/(\d{1,2})/(\d{4})|) { my $new_date = sprintf("%d/%02d/%02d", $3, $2, $1); ... } }

Hope this helps, -gjb-