ISAI student has asked for the wisdom of the Perl Monks concerning the following question:

Hello all. I am trying to get the debugger to print out variable values based on pattern and fail miseraly. See sample code below:

#!/usr/bin/perl -w use strict; my $m=0; my $popop=1; $popop=2; __END__

I run the debugger, do b 5, and can't find the vraiable $popop. See code below:

perl -d ./converCshelltsetenvToSkill.pl Loading DB routines from perl5db.pl version 1.28 Editor support available. Enter h or `h h' for help, or `man perldebug' for more help. main::(./converCshelltsetenvToSkill.pl:3): 3: my $m=0; DB<1> b 5 DB<2> c main::(./converCshelltsetenvToSkill.pl:5): 5: $popop=2; 6: __END__ DB<2> X *popo* DB<3>

What am I doing wrong here?

Replies are listed 'Best First'.
Re: Newbie to PERL debugger
by runrig (Abbot) on Oct 05, 2011 at 15:19 UTC

      No luck there either.

      DB<6> X ~popo DB<7>
        Ah, X and V are only for package variables. They will not work for lexical (my) variables. You can display specific lexical variables with "x", but not by regex. It does say "y" should work for lexicals like V and X, if you have PadWalker installed (which I don't).