http://www.perlmonks.org?node_id=1041975


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})); }