[kw-pm] potentially dumb perl question regarding packages

Robert P. J. Day rpjday at mindspring.com
Thu Oct 27 11:26:01 PDT 2005


On Thu, 27 Oct 2005, John Macdonald wrote:

> The .pl extension stands for Perl Library and it was used back in
> perl 4 days - before packages and modules were invented. They still
> work, of course.  Specifying a package name in top level code makes
> subsequent global names default to that package instead of the
> default "main" package.  So, any subroutines defined after the
> package statement, or any global variables referenced will be in
> that package.  If there are any uses of "fred::foo" (or the older
> variant "fred'foo") in the other files, they refer to the variable
> or subroutine named "foo" defined in the package "fred".  If there
> are no such references, then the package declaration was probably
> being used to make the variables/subroutines used in that code be
> separate from variables/subroutines of teh same name in other files.
> (And the programmer learned perl in the days before the "my"
> declaration was added to the language and hadn't gotten around to
> using that new-fangled invention yet. :-)

in short, in my context, it doesn't *hurt* but it has no value.

rday


More information about the kw-pm mailing list