@array = qw( is an to for from); @strs =("is that true","this is from presentation","to create"); print join("\n",@strs); print "\nTO DELETE: [@array]"; print "\n------PROCESS--------\n"; foreach $str (@strs) { @words=split(/\s+/,$str); print "\nWords in [$str] are [". join(",",@words)."]"; foreach $word (@words) { if(grep {$word eq $_} @array) { print "\n\tDeleting [$word] from [$str]"; $str=~s/\b$word\b//g; } } } print "\n--------OUTPUT---------\n"; print join("\n",@strs);