# Reverse sort the set and partitions and insert sums
####
@$rs = reverse sort numerically @$rs ;
@a = ($sa, reverse sort numerically @a) ;
@b = ($sb, reverse sort numerically @b) ;
##
##
# Done -- return partitins in required order
##
##
if ($a[0] >= $b[0]) { return (\@a, \@b) ; }
else { return (\@b, \@a) ; } ;
} ;
##
##
# Sort the callers array in-place
@$set = sort{ $b<=>$a } @$set;
return $sumA >= $sumB
? ([ $sumA, sort{ $b<=>$a } @partA ], [ $sumB, sort{ $b<=>$a } @partB ])
: ([ $sumB, sort{ $b<=>$a } @partB ], [ $sumA, sort{ $b<=>$a } @partA ])
;
}