in reply to How do I add entries to a hash array in a different scope?
makes a (shallow) COPY of the hash, via the hash-ref.my %h = %$ptr;
Then
make a COPY of the array-ref into the zero'th element of @a (probably not what you intended).my @a = $h{'stack'};
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:
(Untested). See 'Typeglobs and Filehandles' in 'Perldata'.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
You will need to tweak 'use strict', to enable typeglobs.
Potentia vobiscum ! (Si hoc legere scis nimium eruditionis habes)
|
|---|