Hello, I want to write a simple debug-print subroutine, which you
could call like this:
$foobar = "foobar";
dbgPrint foobar;
and it would print the variable name and value. I came up with the
following:
sub dbgPrint {
my $arg = $_[0];
my @up = caller;
print "file ".$up[1]."\tline ".$up[2]."\t".$arg." is
".${$arg}."\n";
}
This works great, but only for global variables. If I have
my $foobar = "foobar";
then of course it does not work. Well it is easy to write something
that would work like this
dbgPrint foobar, $foobar
but this seems redundant - how to just use one argument??
Mark
--
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]
http://learn.perl.org/