in reply to help with the function

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.

Replies are listed 'Best First'.
Re^2: help with the function
by AnomalousMonk (Archbishop) on Nov 03, 2008 at 18:42 UTC
    ++ysth for an admirably clear explanation, and good luck to suhailck on his or her homework/exam problem.