use constant FOO => 42; my $var = 'FOO'; print &{$var} . "\n"; print defined( &{$var} ) ? "true\n" : "false\n";
Result:
# 42 # true
But this is a bad idea, on many levels ...
In reply to Re: Constant name stored in a string
by WizardOfUz
in thread Constant name stored in a string
by SBECK
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |