my $target = 'this is a test of the servise'; for my $is ($target =~ /is/g) { $target =~ s//are/; } print $target\n"; #yields 'thare are a test of the servaree'