@$points = sort { $a->[3] <=> $b->[3] } @$points; foreach (@$points) { print " $_->[3] $_->[0] $_->[1] $_->[2] \n"; }