in reply to How do I add entries to a hash array in a different scope?

Your statement
my %h = %$ptr;
makes a (shallow) COPY of the hash, via the hash-ref.

Then

my @a = $h{'stack'};
make a COPY of the array-ref into the zero'th element of @a (probably not what you intended).

zwon(++)'s solution works directly off the references to the original objects.

If you want to use the syntax you are attempting, you need to make symbolic references, instead of copies:

local *h=$ptr; # %h now is synonymous with %debug local *a=\$h{stack}; # @a is another name for the anon array @{ $h{ +stack} } # Now, a 'push' into @a will change %debug
(Untested). See 'Typeglobs and Filehandles' in 'Perldata'.

You will need to tweak 'use strict', to enable typeglobs.

     Potentia vobiscum ! (Si hoc legere scis nimium eruditionis habes)