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

You didn't show how are you adding element into $debug{stack} in testStack, but if $ptr contains reference to %debug, you can do it as follows:

push @{$ptr->{stack}}, $new_elem; $ptr->{stack}[7] = $new_value;

Also see References quick reference.