The
<=> compares $_ and $_[0] and returns -1, 0, or 1, depending on whether $_ is less than, equal to, or greater than $_[0]. The
(LIST1)[LIST2] syntax is a list slice - it returns the elements of LIST1 specified in LIST2. LIST2 is the -1, 0, or 1, which respectively get the last, first, or second element of LIST1, so it gets \@e if they were equal, \@g if $_[0] was the greater, and \@l if $_[0] was the lesser. The @{EXPR} syntax treats EXPR as an arrayref and uses the referred to array (so @e, @g, or @l), and the push pushes $_ onto that array. The for loops over @_, aliasing $_ to each element in turn, doing the comparison to the first element and the push to different arrays depending on the result of the comparison.