Putting the eval inside a sub can be must slower if that sub is called many times (more than once) since Perl will have to recompile $code each time the sub is called.
my $sub = eval "sub { $code }"; compiles the Perl code once, regardless of how many times you execute it.
Ted Young
($$<<$$=>$$<=>$$<=$$>>$$) always returns 1. :-)In reply to Re^2: Creating subroutines on the fly
by TedYoung
in thread Creating subroutines on the fly
by pander
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |