while (){ next unless /\bcat\b/i; s/brave/frigthened/; print $_; } __DATA__ My Cat is brave but ocicat is also brave and dog is brave catwoman wonderbrave