No such thing as a small change | |
PerlMonks |
Re^3: sub execution order aka missing semicolon after sub callby johngg (Canon) |
on Apr 07, 2016 at 10:41 UTC ( [id://1159799]=note: print w/replies, xml ) | Need Help?? |
The idea with the habit of adding () after all sub-calls is indeed a very good idea. There is a special case where the use of parentheses is not appropriate. If you call subB from within subA using the syntax &subB with no parentheses then the argument list of subA will be passed to subB. See this node for an example. The subroutine doesn't actually have to be called from within another subroutine; it is the content of @_ that matters, as demonstrated by the following code.
I hope this is of interest. Cheers, JohnGG
In Section
Seekers of Perl Wisdom
|
|