foreach $WORD in (@WORD_LIST) { $LINE =~ s/($WORD)/$1<\/i><\/b><\/font>/gi && $contains_word++; }