in reply to How to sort an array

This is the sort of situation Sort::Fields is designed for:
use Sort::Fields; # sort on the second element (i.e. element #1) @sorted = fieldsort '\|', [1], @lines;