How to put a global variable in a package, accessible to users of that package?
- From: mrstevegross@xxxxxxxxx (Mrstevegross)
- Date: Thu, 30 Oct 2008 11:42:36 -0700 (PDT)
I have a package named "Foo" in which I want to define some package-
level constants (such as $VAR="soemval"). I want those constants
available to users of package Foo, so the following code would work:
=== foo.pl ===
package foo;
use constant VAR => "someval";
=== bar.pl ===
use foo;
print $foo::VAR;
It doesn't appear to be working; it compiles ok, but it prints
nothing. I thought it would print "someval".
Any ideas?
Thanks,
--Steve
.
- Follow-Ups:
- RE: How to put a global variable in a package, accessible to users of that package?
- From: "Stewart Anderson"
- RE: How to put a global variable in a package, accessible to users of that package?
- Prev by Date: Re:signal processing INT or TERM
- Next by Date: confused about reference
- Previous by thread: regex for &
- Next by thread: RE: How to put a global variable in a package, accessible to users of that package?
- Index(es):
Relevant Pages
|