Packages are a way to politely separate the global symbol table. Lexicals were introduced later in Perl history to have more traditional "private" variables.
Because packages are global, there are no restrictions from any part of the code pushing to or pulling from any part of the global symbol table. Think of a package declaration as "in this area of this file, I don't have to type that silly package name in front of all my global names: Perl is doing it for me!". That's all it's doing, but if you spell out a package name explicitly, you're just doing the typing yourself.
I have a column on the relationship of my, our, packages, and lexicals, and my Alpaca book also goes into the subject in greater depth.
-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.
In reply to Re: Packages, scope, and lexical variables
by merlyn
in thread Packages, scope, and lexical variables
by DigitalKitty
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |