"be consistent" | |
PerlMonks |
How do I initiate a constant with variable value?by accessdenied (Acolyte) |
on Jun 04, 2010 at 13:07 UTC ( [id://843110]=perlquestion: print w/replies, xml ) | Need Help?? |
accessdenied has asked for the wisdom of the Perl Monks concerning the following question: Hi. I would like to create a constant but it's value is known only in runtume. I did like this:
but running this code print('Got const [', CNST, ']');I got warning "use of uninitialized ..." and brackets are empty - []. Is there any way to initialize constant like I want? What I'm trying to do is having some object which is defined in the module and which can be used from script which uses this module but in readonly mode. I can define our $var which will be available with $MODULE::var but this allow to change value and I would like to avoid change.
Back to
Seekers of Perl Wisdom
|
|