- or download this
my %monthindex; @monthindex{@months} = 0 .. $#months;
- or download this
my @sorted = sort { $monthindex{substr $a, 0, 3} <=> $monthindex{subst
+r $b, 0, 3} || $a cmp $b } @files;
- or download this
my @sorted = map $_->[0],
sort { $a->[1] <=> $b->[1] || $a->[0] cmp $b->[0] }
map [ $_, $monthindex{substr $_, 0, 3}],
@files;
- or download this
my @months = qw(jan feb mar apr may jun jul aug sep oct nov dec);
my %monthindex; @monthindex{@months} = 0 .. $#months;
...
sort { $a->[1] <=> $b->[1] || $a->[0] cmp $b->[0] }
map [ $_, $monthindex{substr lc, 0, 3}],
@files;