in reply to How to sort the data in Array which has format MMYY
You could turn the format from MMMYY into YYMM and then sort numerically. The following sub also takes care or the capitalization issue and fits into your original post:
sub by_month { ($a=~/(...)(..)/,sprintf('%02d%02d',$2,$mon->{ucfirst lc $1})) <=> ($b=~/(...)(..)/,sprintf('%02d%02d',$2,$mon->{ucfirst lc $1})); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: How to sort the data in Array which has format MMYY
by kum@12 (Initiate) on Jul 02, 2013 at 14:38 UTC | |
by hdb (Monsignor) on Jul 02, 2013 at 14:43 UTC | |
by AnomalousMonk (Archbishop) on Jul 02, 2013 at 20:51 UTC |