Reputation: 83
I am wondering how the big X
command works in Perl debugger. So I have the following silly.pl script:
#!/usr/bin/perl -w
use strict;
my $var1 = 99;
print "$var1\n";
I run perl -d silly.pl
, and step to the 4th line. There I type in the debugger:
X var1
But nothing shows up. How should I use X
to display the value of var1
? (If I remove use strict;
and don't use my
, then I can get X var1
working, but that seems not a solution.)
With Many Thanks!
Upvotes: 3
Views: 3851
Reputation: 3037
hitting h in the debugger show this.
V [Pk [Vars]] List Variables in Package. Vars can be ~pattern or !pattern.
X [Vars] Same as "V current_package [Vars]".
Upvotes: 2
Reputation: 2520
The X
command prints current package variables, e.g. declared as our
. For lexical scope variables use x
or y
(needs PadWalker
module installed) commands.
Upvotes: 4