in reply to Re: sorting dates in YYYYMMDD format
in thread sorting dates in YYYYMMDD format
Hi Masters.
I solved the problem
@dates = ('20130601', '20130401', '20130501'); my @sorted = map $_->[0], sort { $a->[1] cmp $b->[1] } map [ $_, join('', (/(..)(..)(....)/)[0,1,2]) ], @dates; # DD-MM-YYYY print "@sorted\n";
Output
20130401 20130501 20130601
Thanks all
In Section
Seekers of Perl Wisdom