while my $text=<$testo>){ ... $count += () = /\b$key\b/ig while <>; }
The <> file handle is exhausted in the first run of the outer while loop, thus certainly not doing what you want. Why do you read from <> at all? Doesn't $text already contain an input line?
In reply to Re: Counting occurence of a list of word in a file
by moritz
in thread Counting occurence of a list of word in a file
by b_vulnerability
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |