I am new in Perl. I just need to send a general function that takes two parameters to another function and then call the first function from inside the second function. I am not very sure how that can be done. Here is the code I am trying to write.
sub add { return $_[0] + $_[1]; }
sub subt { return $_[0] - $_[1]; }
sub dosth
{
my ($func, $num0, $num1) = @_;
# how to call code $func with arguments $num0 and $num1 and return the return value of $func
}
print dosth(add, 3, 2) . " " . dosth(subt, 3, 2); # desired output: 5 1