develooper Front page | perl.perl5.porters | Postings from September 2003

Re: $1, $2, et al -- docs misleading about scope

Thread Previous | Thread Next
david nicol
September 4, 2003 02:02
Re: $1, $2, et al -- docs misleading about scope
Message ID:

Japhy wrote, some time ago:
>   The numbered variables ($1, $2, $3, etc.) and the related punctuation
>   set ($+, $&, $`, $', and $^N) are all dynamically scoped until the end
>   of the enclosing block or until the next successful match, whichever
  comes first.  (See "Compound Statements" in perlsyn.)

> [...]

> I don't know the best way to properly word this in the docs.  Any
> suggestions?

how about:

-  comes first.  (See "Compound Statements" in perlsyn.)
+  comes first.  (Body blocks of conditional and looping constructs
+  are considered to persist at the same level as the control
+  variables. See "Compound Statements" in perlsyn.)

how many of these do I need to have accepted before I get listed in the
AUTHORS file? </vanity>

David Nicol / If at first you don't succeed, use a bigger hammer. 

Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About