our %debug = (); $debug{'level'} = 1; $debug{'stack'}[0] = "main()"; $rv = MyModule::testStack(\%debug); my @t = $debug{'stack'}; my $CountMain = scalar (@t); print "$CountMain \n"; # This prints 1 #Now there is another subroutine defined in another module: sub testStack { my $ptr = $_[0]; my %h = %$ptr; my @a = $h{'stack'}; push (@a, "testStack()"); my $count = scalar (@a); print "$count \n"; # This prints 2 return 1; }