This extended sorting algorithm allows you to a) sort an array by ANY field number, not only the first b) find duplicates in your data-set and sort them out. WWW: https://metacpan.org/release/Sort-Array