Actually there is. As soon as you add that ampersand the constants cease to be constants. And instead of inlining the value during compile-time, Perl actually calls the functions each time. Therefore I'd rather add an empty pair of braces:
Try to run these three and see the difference:%hash = ( FOO() => 'FOO description, ...)
perl -MO=Deparse -e "use constant FOO => 5; print FOO,qq{\n};" perl -MO=Deparse -e "use constant FOO => 5; print &FOO,qq{\n};" perl -MO=Deparse -e "use constant FOO => 5; print FOO(),qq{\n};"
Jenda
Always code as if the guy who ends up maintaining your code
will be a violent psychopath who knows where you live.
-- Rick Osborne
Edit by castaway: Closed small tag in signature
In reply to Re: Re: Re: Problem with constant pragma and some hash definitions
by Jenda
in thread Problem with constant pragma and some hash definitions
by dbush
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |