You could try using a reference to a function.
sub some_function {
print "foo";
}
my $some_function = \&some_function;
You can pass $some_function like any other scalar, but you need to use the arrow operator to run the function.
Assuming you pass references to functions to your sub rotuine:
sub function_runner {
my @exit_functions = @_;
my $counter = 1;
foreach my $function (@exit_functions) {
print "Performing exit function $counter:\n";
$counter++;
$function->();
}
print "\nAll exit functions completed.\n";
}
Last edited by KevinADC; Sep 16th, 2008 at 12:06 am.
Reputation Points: 246
Solved Threads: 67
Practically a Posting Shark
Offline 898 posts
since Mar 2006