@lines = sort {($b =~ /(?:\|([\w\s]+)){2}/)[0] <=> ($a =~ /(?:\|([\w\s]+)){2}/)[0] } @lines;