Help for this page
my @xx = ( 'dfb|cy|nmju', 'dfb|my|jhiho', 'aaa|zz|gggg' ); ... my @sorted_xx = map { $_->[1] } sort {$a->[0] cmp $b->[0]} map { [ (split /\|/, $_)[$sort_field], $_ ] } @xx;
sub sorter { my @arr_a = split /\|/, $a; my @arr_b = split /\|/, $b; return $arr_a[$sort_field] cmp $arr_b[$sort_field]; }