Re: "temp" vs "my"

2018-10-05 Thread Jonathan Scott Duff
What you want is OUTER ... my $v = "original"; > { > my $v = OUTER::<$v>; > say $v; > $v = "new one"; > say $v; > } > say $v; It's how you access the outer scope from an inner scope. -Scott On Wed, Oct 3, 2018 at 1:10 AM yary wrote: > Reading and playing with

Re: "temp" vs "my"

2018-10-03 Thread Brad Gilbert
Note that OUTER::<$v> only goes up one level. So to go up two levels OUTER::OUTER::<$v> There is also OUTERS::<$v> which will go up as many levels as it needs to find the variable { my $a = 1; my $b = 2; { my $a = 3; { say

Re: "temp" vs "my"

2018-10-03 Thread yary
Thanks! Knew I'd seen the concept of OUTER but couldn't remember the keyword. -y On Wed, Oct 3, 2018 at 5:51 AM, Timo Paulssen wrote: > you can refer to the outer $v as OUTER::('$v'), that ought to help :) > On 03/10/2018 08:10, yary wrote: > > Reading and playing with

Re: "temp" vs "my"

2018-10-03 Thread Timo Paulssen
you can refer to the outer $v as OUTER::('$v'), that ought to help :) On 03/10/2018 08:10, yary wrote: > Reading and playing with https://docs.perl6.org/routine/temp > > There's an example showing how temp is "dynamic" - that any jump > outside a block restores the value. All well and good. > >

"temp" vs "my"

2018-10-03 Thread yary
Reading and playing with https://docs.perl6.org/routine/temp There's an example showing how temp is "dynamic" - that any jump outside a block restores the value. All well and good. Then I thought, what if I want a lexical temporary value- then use "my"- and this is all well and good: my $v =