I understand that "string-eval" can be used for it. But I am looking for some alternative to achieve it without eval. Reason being "string-eval" fail the Perl critic and as per client policy I can not use it.
What are some alternative to do that without eval?
Here is what I am trying to do:
I am passing a dynamic generated code reference to a function. This function evaluates this code reference and assign the result to a variable.
Coderefs do not need
evalto run. Simply dereference a coderef to invoke it. This is explained in perldoc perlref.