Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: How to prevent metacharacter interpolation

by jmcnamara (Monsignor)
on Mar 14, 2001 at 15:36 UTC ( [id://64364]=note: print w/replies, xml ) Need Help??


in reply to How to prevent metacharacter interpolation

Use either the quotemeta function:
$pattern = quotemeta( $pattern ); m/$pattern/;
or use the \Q and \E escape characters:
m/\Q$pattern\E/;
They do exactly the same thing; just one is a function and the other works inside regex patterns.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://64364]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (6)
As of 2024-04-16 08:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found