Hi Monks,
for a debugging-sub I would like to pass the name of a variable to the sub. How is this possible?
What I have so far (untested yet):
say sdump($some_ref); sub sdump { my $ref = shift || croak('nothing to dump - missing ref'); my $depth = shift || 2; local $Data::Dumper::Maxdepth = $depth; return 'Dump of $var_name: ' . "\n" . Dumper($ref) }
How can I get the $var_name('$some_ref' in this exemple) into the sub?
In reply to passing a variables name to a subroutine by LANTI
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |