develooper Front page | perl.perl5.porters | Postings from November 1999

Re: [ID 19991115.012] Localization and goto()

From:
Nick Ing-Simmons
Date:
November 16, 1999 09:47
Subject:
Re: [ID 19991115.012] Localization and goto()
Message ID:
199911161746.RAA29464@tiuk.ti.com
Tom Christiansen <tchrist@jhereg.perl.com> writes:
>>$a = 5;
>>sub a { print $a }
>>sub b {local $a = 9; goto &a}
>>b;
>
>>This still prints 5... :-(
>
>And this is a problem exactly how?
>
>b()'s frame goes away.  

One could expect the frame to stay until the "goto" returned ;-)

>So its local view of $a 
>went away.  
>
>I do not find this behaviour astonishing.

-- 
Nick Ing-Simmons <nik@tiuk.ti.com>
Via, but not speaking for: Texas Instruments Ltd.




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