if $text=~m/\bdirector\b/ $director=1; if $text=~m/\bresignation\b/ $resign=1; #### if $text=~m/\b(director|resignation)\b/ # code that shows which word matched;