I wouldn't use an eval, if it's not necessary.
perl -e '$code = sub{ print "Ovid is a blowhard\n" };&$code'
This is better because your code is checked at compile time and you don't reinvoke the Perl interpreter.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
In reply to (Ovid) Re: Coderef from scalar.
by Ovid
in thread Coderef from scalar.
by vaevictus
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |