in reply to How to sort an array
use Sort::Fields; # sort on the second element (i.e. element #1) @sorted = fieldsort '\|', [1], @lines; [download]