in reply to Using string literal in regexp

You should use qr operator.
If the character is special one, escape it with '\'.
You may want to read this manual - perlre


Replies are listed 'Best First'.
Re^2: Using string literal in regexp
by chromatic (Archbishop) on Jun 17, 2006 at 07:32 UTC

    I don't think this is helpful.

    How does qr// help? Interpolation happens there too!

    How do you perform generalized backslash escaping on an arbitrary string? Do you run it through another regex first? Do you recreate the behavior of quotemeta or \Q...\E then, perhaps badly?

    davorg has given far better advice.