in reply to Re: Re: Problem with constant pragma and some hash definitions
in thread Problem with constant pragma and some hash definitions
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^4: Problem with constant pragma and some hash definitions
by particle (Vicar) on Jul 21, 2003 at 12:59 UTC |