Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

Re: Calling a sub from a variable ?

by inq123 (Sexton)
on Mar 22, 2005 at 10:26 UTC ( #441415=note: print w/replies, xml ) Need Help??

in reply to Calling a sub from a variable ?

I'm not aware of a significant performance penalty on eval, although of course one'd expect a delay due to compilation. But in your case it's unlikely to be slower than &$function. Additionally it offers stability to your program by catching errors.

Security is a concern for eval, but if you're calling the same code &$function anyway, there's no more security concern in eval than in &$function call. The latter also has to turn off strict (partially), not the best thing to do.

So I suggest to stick to eval since AFAIK it works, it performs, and it handles errors.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://441415]
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (4)
As of 2020-02-24 11:42 GMT
Find Nodes?
    Voting Booth?
    What numbers are you going to focus on primarily in 2020?

    Results (104 votes). Check out past polls.