|Welcome to the Monastery|
Re: Re: How do I write subs that take bare blocks as args?by educated_foo (Vicar)
|on Jun 28, 2002 at 06:33 UTC||Need Help??|
..which also worked. Is there any advantage/disadvantage to this over eval?The eval version probably isn't doing what you want, unless you are doing something deliciously perverse. I think your original code is doing this:
So you're passing @_ to the user's block, then eval'ing the result. This ends up working because the block presumably accesses $_ directly, and returns an integer (which evals as itself). But it's an ... interesting way to get the job done. An optimist would say that the eval version is "very general".