Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

RE: Scope of regular expression variables

by nuance (Hermit)
on Aug 29, 2000 at 22:58 UTC ( #30190=note: print w/replies, xml ) Need Help??


in reply to Scope of regular expression variables

The behaviour you are seeing is caused by the fact that $1 and friends are only overwritten by a successfull match or substitution that has backreferences.

So your code says check this expressions against $1, if that matched then and only then will $1, $2 & $3 be given the new values. If it didn't match, then there is no statement to overwrite $1, so your that your else clause is checking the same value of $1.

Nuance

  • Comment on RE: Scope of regular expression variables

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (3)
As of 2022-01-22 15:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:












    Results (63 votes). Check out past polls.

    Notices?