127

Built-In Functions
Extending Sort

  • The sort() function can be extended to provide alternate sort orders

  • The first argument to sort() can be a subroutine name

  • The subroutine is called repeatedly by sort with the variable pair $a and $b as parameters

  • The subroutine must return -1, 0, or 1 representing respectively less-than, equal-to, or greater-than