Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: $1 don't reset (non loop)

by MCS (Monk)
on Feb 17, 2004 at 13:23 UTC ( [id://329583]=note: print w/replies, xml ) Need Help??


in reply to $1 don't reset (non loop)

Why doesn't $1 reset when the regexp doesn't match anything?

It's a feature, not a bug :-)

Actually there are times when it comes in handy, if I'm doing stuff where I need it to be redefined I usually use an if {} elsif{} else{} loop. That way it only goes into the {} if the if (or elsif) matches. If you don't want to use an elsif (because you are checking a few things) just use multiple if statements.

Replies are listed 'Best First'.
Re: Re: $1 don't reset (non loop)
by jockel (Beadle) on Feb 17, 2004 at 14:01 UTC
    Well... this time I think it's a bug =)..
    It would've been great if you could define this so
    called "feature" with a special $ variable.

    Anyway .. now when I know about this "feature" and won't make the mistake again =)
    /jocke

Log In?
Username:
Password:

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

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

    No recent polls found