in reply to function calling
If the declaration precedes any call, perl already knows that print_argu arg,...; is a call to a sub, whereas if the order is reversed i.e. the call precedes the declaration, perl needs a hint as to what sort of symbol print_argu represents. In this case, the hint can be either...
orprint_argu("Hello function!\n"); sub print_argu{ print "@_\n"; }
sub print_argu; print_argu "Hello function!\n"; sub print_argu{ print "@_\n"; }
That being said, it is recommended, in PBP, that the parens are omitted only for calls to builtins.
|
|---|