Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: What do \Q and \E mean?

by mifflin (Curate)
on Jun 19, 2005 at 02:47 UTC ( [id://468053]=note: print w/replies, xml ) Need Help??


in reply to What do \Q and \E mean?

In a regular expression, all chars between the \Q and \E are escaped. See quotemeta in perlfunc.
In your code sample, you are appending a string, that looks like a regular expression, onto the end of $code.
update
I couldn't find my Perl Cookbook, must have left it at work, however, the code you are referring to is probably assembling a regex so it then can eval it. I seem to remember it was showing some way of performing efficient variable regex's.

Replies are listed 'Best First'.
Re^2: What do \Q and \E mean?
by apt_get (Acolyte) on Jun 19, 2005 at 03:25 UTC
    Well, the code is from a script that for an input file, translates a string found in a set of strings ($in) to a corresponding string found in another set of strings ($out), which have been created elsewhere, with appropriate mappings. Example 1.4 from the Perl Cookbook. Sorry for not posting more code, just wanted clarification on those weird (now clear) \Q and \E switches.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (4)
As of 2024-04-25 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found