I have some code which relies heavily on the fact that I can localize variables in recursive functions. However, sometimes I need to examine the top of the local stack:
#!/usr/bin/perl -l use strict; use warnings; our $x = 3; foo(7); sub foo { local $x = shift; print $x; # is there any way to get the "3" value? }
The obvious solution is for me to cache the top-level values of the variables in question and that's probably what I will do, but I was wondering if there is any way to examine the stack created by local? I'd prefer to do this without C, but if I must ...
Cheers,
Ovid
New address of my CGI Course.
In reply to Examing local's stack by Ovid
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |