in reply to syntax for calling a function
Using the ampersand allows you to call a function without parentheses:
Perl will interpret a bareword as a subroutine call with no arguments, but then you have to make sure that perl knows your bareword is a subroutine:&foo; sub foo { print "Hello\n" }
foo; # does not call foo() sub foo { print "Hello\n" } foo; # calls foo()
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: syntax for calling a function
by TGI (Parson) on Jun 27, 2008 at 23:20 UTC | |
|
Re^2: syntax for calling a function
by alexm (Chaplain) on Jun 27, 2008 at 19:08 UTC | |
by chromatic (Archbishop) on Jun 27, 2008 at 19:11 UTC |