in reply to Searching through a word file using an array element

I agree with the previous poster, your code looks more complex than it needs to be.

Anyways, this line looks suspicious to me:

if(grep(/\b$cuvintecareconteaza\b/i,@read))

Not sure why do you have a matching operator inside a grep? If I were to approach this problem I think I would do something more like(untested):

my $line, $word, @array; while( $line = <FILE> ){ foreach $word ( @array) ){ do_something if( $line =~ /\b$word\b/g ); } }