The debugger is a bad place to play with scoping like this. In effect when you evaluate single lines like this they're more like doing an eval within the scope of the program (more or less; I'm sure someone more familiar with the perl5db could give more specifics). It's kind of like (handwaving) textually shimming in say DebugDump( eval { YOURTEXTHERE } ) into wherever you're looking at and seeing the result.
This means that your
my declaration is happening inside of a transient scope (that single eval statement) and then it's going away. Since the my was affecting only
$a when you check for defined-ness it fails because the package
$a wasn't defined (however your modifications to
$x et al changes the package versions of those and the values
do persist after the statement).
$ cat test.pl
use 5.032;
my $foo = 10;
say qq{foo: $foo}
$ perl -d test.pl
Loading DB routines from perl5db.pl version 1.57
Editor support available.
Enter h or 'h h' for help, or 'man perldebug' for more help.
main::(test.pl:2): my $foo = 10;
DB<1> x $foo
0 undef
DB<2> n
main::(test.pl:3): say qq{foo: $foo}
DB<2> x $foo
0 10
DB<3> my $foo = 20
DB<4> x $foo
0 10
DB<5> my $foo = 20; say qq{foo: $foo}
foo: 20
DB<6> x $foo
0 10
Simple rule of thumb I tend to follow is just don't use my (or state or our) from the debugger command line to try and affect anything outside of that immediate command line.
The cake is a lie.
The cake is a lie.
The cake is a lie.