The ampersand (&
) is the identifier used to call
subroutines. Most of the time, however, subroutines can be used in
an expression just like built-in functions. To call subroutines
directly:
name
(args
); # & is optional with parenthesesname
args
; # Parens optional if predeclared/imported &name;
# Passes current @_ to subroutine
To call subroutines indirectly (by name or by reference):
&$subref(args
); # & is not optional on indirect call
&$subref; # Passes current @_ to subroutine
18.116.60.158