in reply to Behavior of 'our' variables in the package-namespace
Without the BEGIN your code looks somewhat like:
my $foobar_o = Foo::Bar->new("object o"); printf "%s\n", $foobar_o->text(1); # some random stuff our $data = { 1 => "one", 2 => "two", 100 => "one hundred", }; # some more random stuff
from which you can see the initialization of $data doesn't happen until after the call to text. Nothing to do with our versus my. Put the package at the top of the file and educate your users, or stick with the BEGIN. In either case "my" would be better than "our" in the context shown.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Behavior of 'our' variables in the package-namespace
by Apero (Scribe) on Nov 02, 2015 at 02:48 UTC |