SBECK has asked for the wisdom of the Perl Monks concerning the following question:
With constants, I can test that one is defined, or use it trivially:
use constant FOO => 42; print defined(FOO); print FOO;Now, if I have the name of the constant stored in a string:
$var = "FOO";how can I operate on $var to find out if the constant stored in it's name is defined, and what it's value is?
If I'm understanding what I've read, it may not be possible... but if it is, I'd like to know how.
Thanks
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Constant name stored in a string
by WizardOfUz (Friar) on Jan 28, 2010 at 14:25 UTC | |
|
Re: Constant name stored in a string
by umasuresh (Hermit) on Jan 28, 2010 at 15:17 UTC | |
|
Re: Constant name stored in a string
by JavaFan (Canon) on Jan 28, 2010 at 15:33 UTC | |
by WizardOfUz (Friar) on Jan 28, 2010 at 16:54 UTC |