my @sorted = sort { $monthindex{substr $a, 0, 3} <=> $monthindex{substr $b, 0, 3} || $a cmp $b } @files;