in reply to sorting and array by [2]
If this was meant to be the sort subroutine, it has some problems (other than the aready mention ones). The or (||) is operating on the results of two comparison operators that return -1, 0 , 1.$a->[2] cmp $b->[2] || $a->[2] <=> $b->[2]
Update: Based on this node : Q&A Node on multicolumn sorting and some other research I realized my orignal statment was not fully correct. The node does not mention that this works because the or operater (||) short circuits if not false. The whole expression returns the -1 or 1 value for the first sub expression that has non false value or return 0 if they are all equal. I guess a real monk should add this to the node.
|
|---|