in reply to Re^5: type glob
in thread type glob
Then you couldn't have multiple variables with the same name, as in:my $x; sub foo { my $x; my $x; { my $x; } } sub bar { my $x; }
It seems to me that your code behaves almost exactly like
(except that localising a variable twice doesn't warn, whereas mying twice does) *. Thus, I'm not sure that it's accurate to say that you can't have two variables, both with the same name, in the symbol table **. (You might respond that you can only access one of them at a time, but that's true for lexicals, too.)our $x; sub foo { local $x; local $x; { local $x; } } sub bar { local $x; }
* Of course, since neither code does anything, this might be an even more vacuous statement than is usual for me. :-)
** Ah, but the $x of local $x is the same variable as that of our $x, whereas the $x of my $x is not the same variable as that of the other my $x.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^7: type glob
by ikegami (Patriarch) on Nov 18, 2009 at 19:03 UTC | |
by JadeNB (Chaplain) on Nov 18, 2009 at 20:29 UTC | |
by ikegami (Patriarch) on Nov 18, 2009 at 22:55 UTC |