To expand a bit on
reptile's answer, you can provide your own subroutine reference to
sort. In the subroutine, $a and $b are provided and localized special variables used for comparing two elements to each other. In the code snippet, they're array references, and the special arrow notation is just a way of getting at the second element of each. See
sort for more details.