On Oct 30, 1:51 pm, [EMAIL PROTECTED] ([EMAIL PROTECTED]) wrote:
> On Oct 30, 2:50 pm, [EMAIL PROTECTED] (Paul Lalli) wrote:
>
> >  If there is no strict, 'our' is a no-op.
>
> Not entirely true. The scope of a variable declared with our is
> different from one that's not needed to be declared because use strict
> is not in use.

My, that's some mighty fine crow!  YUUUUUMMMY!

My bad....

Yes, 'our' spans package boundaries, which makes it not a no-op, just
as Nobull said:

$ perl -lwe'
package Foo;
$baz = "hello world";
print $baz;
package Bar;
print $baz;
'
Name "Bar::baz" used only once: possible typo at -e line 6.
hello world
Use of uninitialized value in print at -e line 6.


Compared to:
$ perl -lwe'
package Foo;
our $baz = "hello world";
print $baz;
package Bar;
print $baz;
'
hello world
hello world


I stand suitably humbled, chagrined, and better informed.

Paul Lalli


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to