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-
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: Sorting Dates
by josephjohn (Acolyte) on Nov 24, 2005 at 10:51 UTC | |
by gjb (Vicar) on Nov 24, 2005 at 11:11 UTC | |
by secret (Beadle) on Nov 24, 2005 at 11:17 UTC |
In Section
Seekers of Perl Wisdom