in reply to Re: Accessing lexically scoped variables from a subref
in thread Accessing lexically scoped variables from a subref
All it took to get $i was this:$i = 12; $a = sub { $i };
The only problem with using this is that I have no idea how it actually works. I just assumed that PADLIST contains all the local variables for that reference, but why the two-dimensional AV after that? Or for that matter, why is $i located on the second position of the second array? The others just return a B::SPECIAL, which I have no idea what its purpose is.B::svref_2object($a)->PADLIST->ARRAYelt(1)->ARRAYelt(1)->SV->object_2s +vref
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Accessing lexically scoped variables from a subref
by benizi (Hermit) on Dec 31, 2007 at 04:41 UTC |