Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: ?: and saving backreferences

by ikegami (Patriarch)
on Dec 06, 2006 at 06:10 UTC ( [id://588038]=note: print w/replies, xml ) Need Help??


in reply to Re: ?: and saving backreferences
in thread ?: and saving backreferences

Did you run the code the OP posted? Since at least 5.6.1, the $1 set by the regexp inside the if is no longer in scope outside the if. The following illustrates this clearly.

'a' =~ /(.)/; { 'b' =~ /(.)/; print("$1\n"); # b } print("$1\n"); # a

This is documented in perlvar.

Replies are listed 'Best First'.
Re^3: ?: and saving backreferences
by BUU (Prior) on Dec 06, 2006 at 06:24 UTC
    You are quite correct and I was missinterpreting his comment. Consider it retracted.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others perusing the Monastery: (6)
As of 2024-03-28 08:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found