in reply to Re: sorting dates in YYYYMMDD format
in thread sorting dates in YYYYMMDD format
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: sorting dates in YYYYMMDD format
by hdb (Monsignor) on Jul 04, 2013 at 07:22 UTC | |
by Dallaylaen (Chaplain) on Jul 04, 2013 at 12:49 UTC | |
by AnomalousMonk (Archbishop) on Jul 04, 2013 at 18:41 UTC | |
by Dallaylaen (Chaplain) on Jul 05, 2013 at 03:55 UTC | |
|
Re^3: sorting dates in YYYYMMDD format
by 2teez (Vicar) on Jul 04, 2013 at 08:17 UTC |