Re: Include variables from external perl script
- From: mritty@xxxxxxxxx (Paul Lalli)
- Date: Tue, 30 Oct 2007 13:04:58 -0700
On Oct 30, 1:51 pm, nobul...@xxxxxxxxx (Nobul...@xxxxxxxxx) wrote:
On Oct 30, 2:50 pm, mri...@xxxxxxxxx (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
.
- References:
- Include variables from external perl script
- From: Howa
- Re: Include variables from external perl script
- From: Jeff Pang
- Re: Include variables from external perl script
- From: Ron Bergin
- Re: Include variables from external perl script
- From: Paul Lalli
- Re: Include variables from external perl script
- From: Nobull67@xxxxxxxxx
- Include variables from external perl script
- Prev by Date: Re: Split function
- Next by Date: Re: Split function
- Previous by thread: Re: Include variables from external perl script
- Next by thread: Re: Include variables from external perl script
- Index(es):
Relevant Pages
|