What is a "function module"? An example of what
$command actually contains would help.
I recommend passing a code reference as first argument, this is the most generic way to solve this kind of problem.
use 5.010;
use strictures;
sub execute_command {
my ($code, $params) = @_;
say 'Inside executeCommand';
say 'Currently executing: ', ref $code;
foreach my $element (@{ $params }) {
say "Parameter: $element";
$code->($element);
}
}
my $command = sub {
# I am going to print the arguments I receive!
say @_;
};
execute_command($command, \@paramlist);