How fast is an EVAL String

leif.eriksen at leif.eriksen at
Mon Apr 26 20:46:17 CDT 2004

Just for completeness, I sent Scott a reference to the different ways
Perl processes

eval "string";


eval { block }
(from perldoc -f eval)
eval EXPR
eval BLOCK
               In the first form, the return value of EXPR is parsed and
               cuted as if it were a little Perl program.  The value of
               expression (which is itself determined within scalar
               is first parsed, and if there werenât any errors,
executed in
               the lexical context of the current Perl program, so that
               variable settings or subroutine and format definitions
               afterwards.  Note that the value is parsed every time the
               executes.  If EXPR is omitted, evaluates $_.  This form
is typ-
               ically used to delay parsing and subsequent execution of
               text of EXPR until run time.

               In the second form, the code within the BLOCK is parsed
               once--at the same time the code surrounding the eval
itself was
               parsed--and executed within the context of the current
               program.  This form is typically used to trap exceptions
               efficiently than the first (see below), while also
               the benefit of checking the code within BLOCK at compile

Which one you actually need depends on your requirements, but if eval
BLOCK works for you, use that.

Leif Eriksen
Snr Developer
ph +61 3 9217 5545
leif.eriksen at <> 

The contents of this e-mail and its attachments are confidential and intended
solely for the use of the individual or entity to whom they are
addressed.  If you received this e-mail in error, please notify
the HPA Postmaster, postmaster at, then delete 
the e-mail.

This footnote also confirms that this e-mail message has been swept for
the presence of computer viruses by MimeSweeper.  Before opening or
using any attachments, check them for viruses and defects.

Our liability is limited to resupplying any affected attachments.

HPA collects personal information to provide and market our services.
For more information about use, disclosure and access see our Privacy
Policy at

-------------- next part --------------
An HTML attachment was scrubbed...

More information about the Melbourne-pm mailing list