So it can be done, but don't do it like that, best listen to BrowserUk and use a hash map instead.use constant FOO => "a string"; sub constant_name { return (grep { $_[0] eq (\&{$_})->() } keys %constant::declared)[0] =~ /::(.*?)\z/; } print constant_name(FOO);
_________
broquaint
In reply to Re: The name of a constant
by broquaint
in thread The name of a constant
by Kjetil
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |