[kw-pm] $1 matching question
Daniel R. Allen
da at coder.com
Wed Jul 21 16:22:37 CDT 2004
On Wed, 21 Jul 2004, Tomas Vinar wrote:
> On Wed, 21 Jul 2004, Daniel R. Allen wrote:
>
> > Ah, thanks, that's the ideom I'd used before- if (/whatever/) { print }
> >
> > The camel book chapter 2 says:
> > "the variables $1, $2, $3 ... are automatically localized, and their scope
> > extend to the end of the enclosing block... or to the next successful
> > pattern match, whichever comes first".
> >
> > I guess I'm surprised that $1 didn't go out of scope the next time around
> > the WHILE loop (in the deparsed version); that would be the behaviour of
> > least surprise, as far as I can tell.
>
> Of course, you could have used $1 to buy a coke and avoid all troubles.
I hate it when I'm out of scope and need to use coke instead. I prefer
listerine anyway.
er.
-Daniel
>
> Tomas
>
More information about the kw-pm
mailing list