sub mysort { return $a->[0] <=> $b->[0] || $a->[1] <=> $b->[1] || $a->[9] cmp $b->[9] } my @list; while (<>) { chomp; push @list, [ split ]; } @list = sort mysort @list;