foreach my $i (0 .. $#txtoken) { foreach my $j (0 .. $#{txtoken[$i]}) { if ($txtoken[$i][$j] eq "temeli" and $pstoken[$i][$j] eq "n") { print "$tx[$i]\n" ; } } }