Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

RE: Scope of regular expression variables

by nuance (Hermit)
on Aug 29, 2000 at 22:58 UTC ( [id://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?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2024-04-19 07:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found