Sounds like you could benefit from building some hashes to act as indexes into your two arrays. For the specific example you give, the key of the hash would be the $word and the value would be an array-of-arrays with $linenum $wordnum pairs.
or if you don't want to do that
foreach my $i (0 .. @txttoken) {
my $txtline = $txttoken[$i];
foreach my $j (0 .. @$txtline) {
if ($txtline->[$j] eq "temeli" and $pstoken[$i][$j] eq "n") {
do_something();
}
}
}