in reply to Calling subs with &
Not usually, but it does if the sub is "prototyped"; in which case the call with & will disregard the "prototype".
It can also matter if you don't supply parens on your call; in which case you'll need to declare the sub before you call it unless you use the & on your call.
Enabling warning will help you catch that sort of an error.$ perl -le 'foo; sub foo { print "foo" }' $ perl -le '&foo; sub foo { print "foo" }' foo
$ perl -wle 'foo; sub foo{ print "foo"}' Unquoted string "foo" may clash with future reserved word at -e line 1 +. Useless use of a constant in void context at -e line 1.
-sauoq "My two cents aren't worth a dime.";
|
---|