Multiple choice technology programming languages

Which Operator can be used in sort function for sorting array elements numerically?

  1. <>

  2. >

  3. <=>

  4. cmp

Reveal answer Fill a bubble to check yourself
C Correct answer
Explanation

The <=> operator (spaceship operator) is Perl's numeric comparison operator, returning -1, 0, or 1. It's the standard way to sort numerically: sort { $a <=> $b } @array. The cmp operator is for string comparison, while < and > are simple comparison operators not typically used directly in sort.