Popcorn Dave has asked for the wisdom of the Perl Monks concerning the following question:
Given the following code:
use strict; my ($x, $y, $z); sub dispSymbols { my($hashRef) = shift; my(%symbols); my(@symbols); %symbols = %{$hashRef}; @symbols = sort(keys(%symbols)); foreach (@symbols) { printf("%-10.10s| %s\n", $_, $symbols{$_}); } } dispSymbols(\%main::);
The variables $x, $y and $z are not showing up in the dump. However if I change the my to our then they do show up. The rest of the symbol table does show up as I expected.
Can someone please explain to me why this is happening?
Thanks in advance!
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Dumping symbol table shows variables declared with our but not my
by Happy-the-monk (Canon) on Oct 11, 2004 at 00:17 UTC | |
by Popcorn Dave (Abbot) on Oct 11, 2004 at 02:36 UTC | |
by revdiablo (Prior) on Oct 11, 2004 at 16:46 UTC | |
|
Re: Dumping symbol table shows variables declared with our but not my
by davido (Cardinal) on Oct 11, 2004 at 02:41 UTC |