[Israel.pm] require issue

Jason Elbaum jason.elbaum at gmail.com
Wed Feb 28 07:18:46 PST 2007

> I knew all of this, however since I didn't declare the include file to
> contain a package I assumed that all variables would be brought into the
> main:: namespace.
> Why is this not the case?

It is the case. Variables in the required file are in the main:: namespace.

However, variables declared with my do not reside in the main::
namespace. They are lexically scoped variables, and their namespace is
the one belonging to the innermost block enclosing the my declaration;
in this case, presumably the file scope of the main script file.
Declaring with our would put them into main::.

Jason Elbaum

More information about the Perl mailing list