Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: ${^MATCH} regex special variable(s) and /p regex modifier

by toolic (Bishop)
on Oct 04, 2011 at 01:32 UTC ( #929431=note: print w/ replies, xml ) Need Help??


in reply to ${^MATCH} regex special variable(s) and /p regex modifier

Here is a quote from perlvar:
This is similar to $& ($MATCH ) except that it does not incur the performance penalty associated with that variable, and is only guaranteed to return a defined value when the pattern was compiled or executed with the /p modifier.
I think the key word there is "guaranteed". It seems like the variable gets defined even if /p is not used, although it is not explicitly mentioned. To be safe, I would always use /p when you want those variables.

If you feel the docs should be modified, submit a patch via perlbug.

  • Comment on Re: ${^MATCH} regex special variable(s) and /p regex modifier

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (7)
As of 2016-08-29 07:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    The best thing I ever won in a lottery was:















    Results (399 votes). Check out past polls.