Perl array/sort FAQ - Perl integer array sorting

Summary: How to sort Perl arrays, in this case, a Perl integer array.

Sorting a Perl integer array (technically a Perl numeric array) is relatively simple, well, at least once you know the magic formula. The key thing to know is that you need to provide the Perl sort function a helper function (or block of code) that tells it how to sort integers. By default, the Perl sort function sorts arrays in ASCII order, and that's not going to work very well for you.