@lines = ; for (@lines) { if (/[^\n]*Status Compendium<<.JL>/i ) { # notice that $_ is assumed here foreach my $word (@WordList) { print OUTPUT if($_ ne $word) # here we need $_ for camparison (?) } } }