in reply to 'our' is not 'my'
There is a catch with our that doesn't exist with use vars:
package AA; $AA::var = __PACKAGE__; our $var; print "$var\n"; package BB; $BB::var = __PACKAGE__; print "$var\n"; # Prints 'AA'.
Using curlies when using multiple packages in one file avoids the problem.
{ package AA; $AA::var = __PACKAGE__; our $var; print "$var\n"; } { package BB; $BB::var = __PACKAGE__; print "$var\n"; # Compile error! }
Keeping that exception in mind, our is like no strict 'vars'; on a per-var basis.
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: 'our' is not 'my'
by ruzam (Curate) on Oct 26, 2007 at 15:45 UTC | |
by ikegami (Patriarch) on Oct 26, 2007 at 16:09 UTC | |
by ruzam (Curate) on Oct 26, 2007 at 16:37 UTC | |
by JadeNB (Chaplain) on Nov 26, 2008 at 15:30 UTC |
In Section
Meditations