Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

Re: qr// with /e?

by Anomynous Monk (Scribe)
on Apr 25, 2004 at 04:59 UTC ( [id://347926]=note: print w/replies, xml ) Need Help??


in reply to qr// with /e?

I can think of a couple ways to do that now: $re = qr/${\do{join '|', @days}}/ (as you would interpolate any expression in to any double-quotish construct), or $re = qr/(??{join '|', @days})/ which only evaluates the code when the regex is actually executing (and indeed may evaluate it more than once if backtracked over).

Both forms may have problems with finding the end of the code given e.g. an unmatched } within the code; the latter currently has unfortunate interaction with lexical vars.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-04-25 06:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found