in reply to passing a variables name to a subroutine
for a debugging-sub I would like to pass the name of a variable to the sub. How is this possible?
my $x; yoursub '$x';
Inside your sub you can use PadWalker to access foreign lexical variables, and caller plus symbol table magic for package variables.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: passing a variables name to a subroutine
by LANTI (Sexton) on Feb 18, 2011 at 13:55 UTC | |
by moritz (Cardinal) on Feb 18, 2011 at 15:23 UTC | |
|
Re^2: passing a variables name to a subroutine
by jdporter (Paladin) on Jul 19, 2012 at 15:40 UTC |