Just another Perl shrine | |
PerlMonks |
comment on |
( [id://3333]=superdoc: print w/replies, xml ) | Need Help?? |
Everything you say is "by design" and "documented".
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
In reply to Re: Packages, scope, and lexical variables
by merlyn
|
|