if ($line =~ s/($word(?:s|ed))/$1<\/b>/igm) #### $line= "She was very absorbed in her homework."; $word = "absorb";