use Sort::Key::Maker sn_keysort => qw(str num); my @sortedarry = sn_keysort { (split /\t/)[8, 21] } @foo;