This is the code:
sub function($&) {
my $param1 = shift;
my $code = shift;
# do something with $param1 and $code
}
If I try to call it like this:
function("whatever") {
print "i'm inside the coderef\n";
}
I get Not enough arguments for MyPackage::function at x.pl line 5, near ""whatever" { "
. How can I call it without having to add sub
in front of the code block?