while($string=~ m/reg(ex)/) { $string=~ s/$1/ister/; } #### my $string = "Sometimes there are extra effects you didn't foresee when using a regex."; while($string=~ m/reg(ex)/) { $string=~ s/$1/ister/; } print $string; #### Sometimes there are istertra effects you didn't foresee when using a register.