… | |
… | |
113 | will sort according to the first element of the arrays, i.e. "1,2,3". |
113 | will sort according to the first element of the arrays, i.e. "1,2,3". |
114 | |
114 | |
115 | The custom comparison functions work similar to how "sort" works: $a and |
115 | The custom comparison functions work similar to how "sort" works: $a and |
116 | $b are set to the elements to be compared, and the result should be |
116 | $b are set to the elements to be compared, and the result should be |
117 | greater than zero then $a is greater than $b, 0 otherwise. This means |
117 | greater than zero then $a is greater than $b, 0 otherwise. This means |
118 | that you cna use the same function as for sorting the array, but you |
118 | that you can use the same function as for sorting the array, but you |
119 | could also use a simpler function that just does "$a > $b". |
119 | could also use a simpler function that just does "$a > $b". |
120 | |
120 | |
121 | The first example above corresponds to this comparison "function": |
121 | The first example above corresponds to this comparison "function": |
122 | |
122 | |
123 | { $a <=> $b } |
123 | { $a <=> $b } |