in reply to More Regexp Confusion

On the face of it

use strict; use warnings; my $str = 'asdfGxxOxxAxxTqwerty'; my $foo = 'GOAT'; my @letters = split //, $foo; my $match = join '.*', @letters; $str =~ s/($match)/!$1!/g; print $str;

Prints:

asdf!GxxOxxAxxT!qwerty

does what you want. But I can't help thinking that you are still asking the wrong question. What is the problem you are trying to solve? You have asked how to implement a solution, but we may be able to help more if we know what the actual problem is.


DWIM is Perl's answer to Gödel