performs a numerical comparison of $a and $b

$a - any scalar, converted to a double

$b - any scalar, converted to a double

A value based on comparing $a and $b

Value Description 0 $a is equal to $b < 0 $a is less than $b > 0 $a is greater than $b

sub reverseNumericalOrder { return $2 <=> $1; } @array = @(3, 10, 99, 4.5, 8, 7.534535636, 2, 0.01); @sorted = sort(&reverseNumericalOrder, @array); println(@sorted);

@(99, 10, 8, 7.534535636, 4.5, 3, 2, 0.01)

- <=>; cmp; &sort; &sorta; &sortd; &sortn