in reply to Re: Accessing lexicals in other scopes dynamically by name
in thread Accessing lexicals in other scopes dynamically by name
Sure ... but...
> Note: Subs only capture variables it knows it will need.
which was exactly my intuition, you understand my confusion, since
my enclosed sub from the OP:
$getset=sub { my ($name,$val)=@_; eval('$'.$name."='".$val."'"); # I can access any variable in this + scope };
doesn't know it will need to capture $x!
So whats happening here?
Cheers Rolf
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Accessing lexicals in other scopes dynamically by name
by ikegami (Patriarch) on Jul 30, 2010 at 16:54 UTC | |
by LanX (Saint) on Jul 30, 2010 at 17:22 UTC | |
by ikegami (Patriarch) on Jul 30, 2010 at 18:09 UTC | |
|
Re^3: Accessing lexicals in other scopes dynamically by name
by LanX (Saint) on Jul 30, 2010 at 16:43 UTC |