which we've already established should work. Call the sub from outside the scope in which $x resides and you'll see it fail.my $x="global"; my $test=sub { my $x="pre"; alert($x); # pre my ($name,$val)=@_; eval('$'.$name."='".$val."'"); alert($x); # post }
In reply to Re^3: Accessing lexicals in other scopes dynamically by name
by ikegami
in thread Accessing lexicals in other scopes dynamically by name
by LanX
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |