my @sorted = sort { ( $times{$a} ||= -M $a ) <=> ( $times{$b} ||= -M $b ) } @old_array;