# Bad: (well, it works, but not the way you want it to) $foo =~ $qr; $foo =~ s//bar/; # Good: $foo =~ s/$qr/bar/;