Functions are defined by the sub construct
-
sub subname {
-
statements;
-
expression defining returned result;
-
}
|
They are invoked as follows:
-
$sum = add(); # a simple routine with no args
-
sub add {
-
$a1+$a2+$a3; # Sum three global vars
-
}
|
You can also use the older syntax:
|