in reply to Re^2: How to ignore ampersand and pound signs?
in thread How to ignore ampersand and pound signs?

Nonsense. The single quote you originally posted works just as well.
my $s = q[<IL.Check/>]; my $r = q[<&#x221a;>]; print "Old word: $s\n"; $s =~ s/$s/$r/; print "New word: $s\n";

There's no interpolation or escape sequences here. q vs qq is moot.

The real problem is that you are using text as a regex pattern without first converting it to a regex pattern. ("#" is special under "x".) Use quotemeta or its alias \Q..\E:

my $s = q[<IL.Check/>]; my $r = q[<&#x221a;>]; print "Old word: $s\n"; $s =~ s/\Q$s\E/$r/; print "New word: $s\n";