sub sorter { my @arr_a = split /\|/, $a; my @arr_b = split /\|/, $b; return $arr_a[$sort_field] cmp $arr_b[$sort_field]; }