in reply to Sorting large sets of geometric coordinates

You can create fast multikey sorting functions on the fly with Sort::Key::Multi:
use Sort::Key::Multi qw(nn_keysort) # the "nn" prefix means # to use two numeric keys my @data; while (<DATA>) { my @f = /([\d.]+)/g or next; push(@data, \@f); } my @sorted = nn_keysort { $_->[1], $_->[0] } @data; printf("((%f %f) (%f %f))\n", @$_) foreach @sorted;