[comp.lang.perl] package NAME;

schemers@vela.acs.oakland.edu (Roland Schemers III) (06/18/91)

Just wondering why you have to have a static name for a package instead
of having it be an expression. ie:

package foo;

instead of 

$bar="foo";
package $bar;

Roland
-- 
Roland J. Schemers III                              Systems/Network Manager
schemers@vela.acs.oakland.edu (Ultrix)              Oakland University 
schemers@argo.acs.oakland.edu (VMS)                 Rochester, MI 48309-4401
OU in Michigan! Say it slow: M-i-c-h-i-g-a-n        (313)-370-4323

lwall@jpl-devvax.jpl.nasa.gov (Larry Wall) (06/20/91)

In article <7329@vela.acs.oakland.edu> schemers@vela.acs.oakland.edu (Roland Schemers III) writes:
: Just wondering why you have to have a static name for a package instead
: of having it be an expression. ie:
: 
: package foo;
: 
: instead of 
: 
: $bar="foo";
: package $bar;

Because variable names are looked up in the symbol table at compile time,
not at run time.  Having a parameterized package name implies a parameterized
symbol table, and I don't want to think about what it would take to make
that work.  It would make it easier to write generic packages, but you'd
take a run-time hit.  For now, it's best to use other means of
parameterization, such as *foo and eval.

Larry