http://www.perlmonks.org?node_id=940973


in reply to testing parts of a string against a word database

The problem is that you're trying to iterate through the filehandle NOUNS multiple times without reopening or resetting the file pointer to the beginning of the file.

So either use seek, or change the nesting of the loops so that you just have to go through the file once, i.e.

while (<NOUNS>) { foreach my $element (@senElements) { ... } }