foreach(loop through each $word in search phrase) { $answer =~ tr/$word/$word; }