in reply to Sorting The Date format Values without using any perl modules.
If you want them from most recent to least recent, just reverse:my @list = ('2005-12-01', '2005-11-02', '2005-12-07'); @list = sort @list; print join "\n", @list;
Things get a bit more difficult if your dates are arranged in a different order, but it's still fairly easy to do:@list = reverse sort @list;
use strict; use warnings; my @sort = ('05-11-2006', '01-01-2005', '04-12-2005', '22-03-2005'); @sort = map { join '-', reverse split /-/ } sort map { join '-', reverse split /-/ } @sort; print join "\n", @sort;
|
|---|