in reply to Re^2: Declaring variables recursively
in thread Declaring variables recursively

I'm not entirely positive I understand what you need here. You want the number sorted based on how close they are to... one another, or a central point on the grid? If you want to draw a line connecting them, it sounds like you need to start at one side, and go directly across the plane (left to right for simplicity sake). If that is the case you would want the list sorted based on the X cooridante in each pair. Beacuse these are pairs of numbers, it sounds like you should have an array of arrays (two dimensional array). To sort a two dimensional array based of the first of the two elements in the inner arrays:

my(@sorted_array) = sort({$a->[0] <=> $b->[0]} @unsorted_array);

See sort for details on using sort. See perlre for details on nested data structures.

May the Force be with you