develooper Front page | perl.perl6.language | Postings from May 2005

Re: Scoping of $/

Thread Previous | Thread Next
From:
Rick Delaney
Date:
May 10, 2005 14:24
Subject:
Re: Scoping of $/
Message ID:
20050510212430.GB2689@biff.bort.ca
On Tue, May 10, 2005 at 06:20:44AM -0600, Luke Palmer wrote:
> On 5/10/05, Ingo Blechschmidt <iblech@web.de> wrote:
> > Hi,
> > 
> >   sub foo() {

        say $1;            # undef?

> >     "abc" ~~ /^(.)/;   # $1 now "a"
> >   }
> > 
> >   sub bar() {
> >     "def" ~~ /^(.)/;   # $1 now "d"
> >     foo();
> >     say $1;            # Outputs "d"
> >   }
> > 
> >   bar();
> > 
> >   # Correct (I hope so)?
> 
> Yeah, they're lexical, just like in Perl 5.

Not just like Perl 5, I hope.  If it was then the above would print
"d".

-- 
Rick Delaney
rick@bort.ca

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About