http://qs321.pair.com?node_id=714848


in reply to results from pairs combination

Update Never mind, all wrong. Did the original post get updated?

So you want a sort? Ok.

@sorted_pairs = sort { my@a1 = split',',$a; my@b1 = split',',$b; $a1[0 +] <=> $b1[0] || $a1[1] <=> $b1[1] } @pairs;
The first match returns 0 for a match, so it falls through to the second comparison for things like 2,6 2,7

You need to split the values, otherwise 10,1 would sort before a pair like 2,6, and just using numeric sorting breaks at the comma. It would be even better to split the values ahead of time, but probably not necessary. (You could always use a Schwarzian Transform).

                - Ant
                - Some of my best work - (1 2 3)