in reply to can someone plz decode this sort for me?
The interesting part is the sort block. It consists of two expressions, $g2o{$a} cmp $g2o{$b} and $a <=> $b.
The cmp operator returns three possible values, +1, 0 or -1, depending on whether the left side is greater, equal or smaller than the right side when compared as strings. The same holds true for the <=> ("spaceship") operator, except the comparison is done as numbers.
So putting this together, the sort block first compares $g2o{$a} to $g2o{$b} as strings, and if the two are equal as strings it compares $a and $b as numbers to determine which comes first.
Basically the sort block seems to sort first on the values of %g2o and then on the numerical value of @allgs.
PS: Plz right n full English wrds - it maeks it easier 4 us 2 hlp u. Txtspk might be OK for your mobile but not here.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: can someone plz decode this sort for me?
by rhxk (Beadle) on Aug 08, 2007 at 07:08 UTC |