$ perl -wE' my $s1 = "aaabbbccc" ; my $s2 = "bbb" ; my $s3 = q{!§$%&/()=?}; $s1 =~ s/\Q$s2\E/$s3/g; say $s1' aaa!§$%&/()=?ccc