@array = (6, 5, 4, 3, 2, 1); sub myfunction { return (shift(@_) <=> shift(@_)); } print join(", ", sort {myfunction($a, $b)} @array);