
rovf
Veteran
Feb 6, 2012, 4:28 AM
Post #2 of 2
(1614 views)
|
From your code, I guess that the function is represented as a string, denoting its name. Right? Here is the approach I would take:
(sub { my $fn = shift; eval "&$fn"; })->($call,$arg); I don't claim that this is the best solution, but it's the one which came to my mind when I read your question. It uses the special form &FUNCTIONNAME (i.e. no parenthesis), which passes @_ to the called function.
|