3dan has already answered your question, and you will probably want to do it the way he showed. In the ever-present spirit of TIMTOWTDI, I figured I would show you another approach:
timeout_func($timeout, sub { myfunc($arg1, $arg2) }); sub timeout_func { my ($timeout, $coderef) = @_; ... $coderef->(); }
This creates an anonymous subroutine that does nothing but call your function with the given arguments. This is, incidentally, a nice way to get around an API that takes a coderef but doesn't take in "additional arguments" as 3dan's does, so the technique might be useful for you in the future.
In reply to Re: Passing function to a function using \&<function name> method
by revdiablo
in thread Passing function to a function using \&<function name> method
by rich_d_thomas
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |