Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Re: Regex Capturing: Is this a bug or a feature?

by shotgunefx (Parson)
on Sep 28, 2002 at 15:10 UTC ( [id://201451]=note: print w/replies, xml ) Need Help??


in reply to Re: Regex Capturing: Is this a bug or a feature?
in thread Regex Capturing: Is this a bug or a feature?

The code above is stripped down to an example. I do find this behaviour quite suprising and very NWIM. I would go so far to say that it's documentated incorrectly (at the very least, poorly). Both are described as dynamic scoping.

Looking at perlsub and local() This is known as dynamic scoping. Lexical scoping is ...

-Lee

"To be civilized is to deny one's nature."

Replies are listed 'Best First'.
Re: Re: Re: Regex Capturing: Is this a bug or a feature?
by fruiture (Curate) on Sep 28, 2002 at 15:22 UTC

    Well, the documentation doesn't say they're scoped like "local" would do :-)

    In a way you're right, but imho there is no problem arising from this issue if you always use your own variables instead of $1 .. $n. (Which means you assign your own vars immediately after the match).

    --
    http://fruiture.de
      Well there is no problem if and ONLY if you conditionally assign based on the match.

      I'm not complaining about how it works, more about how it's documented. dynamic and local() are equated many times in the perlpods.

      -Lee

      "To be civilized is to deny one's nature."

Log In?
Username:
Password:

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

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

    No recent polls found