Bob Showalter wrote: > I think you're missing the point. Any reference to the symbol anywhere in > the program "creates" the variable, in the sense you indicated here. > > For example: > > package Foo; > our $x = 1; > print "$_\n" for keys %Foo::; > our $y = 1; > > This prints: > x > y > > So how did y get created "before" the our declaration? Ans: it is entered > into the symbol table at compile time. Take out the "our"'s and you get
you are right and that's because Perl compiles the whole program before it start executing it. 'our $y = 1;' CREATES the varibale and it's in the symble table. you said earlier that 'our' does not create a new variable but that's not true. it's true that if the variable already exists in the current scrope then 'our' does not create it (it simply shadows it like 'local') otherwise, that variable is created. > > "our" simply lets us refer to $Foo::x without the $Foo:: part. It does not > create a new variable. > #!/usr/perl/bin -w use strict; #-- #-- you are saying that the following doesn't create $i? #-- #-- you said it lets you refers $i somewhere else? Refer where? #-- our $i = 1234; #-- #-- where does $i come from if it isn't created in the above? #-- print "$i\n"; __END__ > Take out the "our"'s and you get the same results: > > package Foo; > $x = 1; > print "$_\n" for keys %Foo::; > $y = 1; that doesn't mean 'our' doesn't create the variable. > > "our" simply lets us refer to $Foo::x without the $Foo:: part. It does not > create a new variable. so it does create a new variable. maybe we are referring to the same thing but with different terminology. i don't like to argue over things like that. i am done on this one. david -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]