in reply to Re^3: sort by a multiple columns
in thread sort by a multiple columns

Good observation. The fix is surprisingly simple:
sort { ## Compare through the shorter only for (0..(@$a>@$b ? $#{$b} : $#{$a})) { return $a->[$_] <=> $b->[$_] || next } ## If no difference, the longer array is first @$b <=> @$a;

Caution: Contents may have been coded under pressure.