in reply to Re: why avoid & on function call
in thread why avoid & on function call
Post-declared subs are always resolved as long as Perl knows that it's a sub, that's why Perl5 introduced the "new syntax" ° with parenthesis func()
Pre-declaration is only necessary when avoiding parens in bareword use, like func 1,2,3 because otherwise Perl can't tell at the first parse if its a sub-call or not.
A pre-declaration placeholder can be done by a body-less sub NAME; or with the pragma use subs LIST for multiple names.
Using &ersands just to spare parens() has too many side-effects and should be limited to cases which can't be resolved by pre-declaration.
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
°) "new" as in "new york", "new model army" or "Bojo Churchill".
In Section
Seekers of Perl Wisdom