Core Function CallFunc
From Sputnik Wiki
CallFunc( <function>, <array> )
Contents |
Description
Calls a user defined function contained in a variable.
function
The function name.
array
Optional; An array to send the function as the parameters.
Return Value
Returns whatever the function returns.
Remarks
None.
Example
my $Func = MKFunc('', 'println("Hello World");'); CallFunc($Func);
my $Func = MKFunc('$a, $b', 'println("Value is: " . ($a + $b));'); CallFunc($Func, array(10, 20));
Same as above but this time using the function(){} statement instead of MKFunc
my $Func = Function(){ println("Hello World");}; CallFunc($Func); my $Func = Function( $a, $b ){ println("Value is: " . ($a + $b)); }; CallFunc($Func, array(10, 20));
Same as above but this time calling directly instead of using CallFunc
my $Func = Function( $a, $b ){ println("Value is: " . ($a + $b)); }; $Func(10, 20);