[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]
Re: [ID 20000123.003] [BUG our() 5.005_63] Lexical scoping problems.
On Mon, 24 Jan 2000 00:01:21 EST, Michael G Schwern wrote:
>I've bumped into a few basic scoping problems with our():
>
>our $a = "Outer";
>{
> our $a = "Inner";
> print "$a\n";
>}
>print "$a\n";
>
>$a is "Inner" in both places.
Of course it is; both $a's are aliases to the same global. our doesn't
automatically local()ize. You need to explicitly spell that
C<local our $a = "Inner"> if that's what you want.
I think the "our" variable masks ... warning had better be extended
to warn on this case.
Sarathy
gsar@ActiveState.com
- Follow-Ups from:
-
Michael G Schwern <schwern@pobox.com>
Gurusamy Sarathy <gsar@ActiveState.com>
- References to:
-
Michael G Schwern <schwern@pobox.com>
[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index][Thread Index][Top&Search][Original]