Thread Variablen in reg. Ausdrücken (s#$from#$to#g) (9 answers)
Opened by Gast at 2006-07-17 19:48

renee
 2006-07-17 22:29
#68174 #68174
User since
2003-08-04
14371 Artikel
ModeratorIn
[Homepage] [default_avatar]
Du musst zwischen String-eval und Block-eval unterscheiden.

Die Erklärung dazu steht in perldoc -f eval:
Quote
In the first form, the return value of EXPR is parsed and
executed as if it were a little Perl program. The value of the
expression (which is itself determined within scalar context) is
first parsed, and if there weren't any errors, executed in the
lexical context of the current Perl program, so that any
variable settings or subroutine and format definitions remain
afterwards. Note that the value is parsed every time the "eval"
executes. If EXPR is omitted, evaluates $_. This form is
typically used to delay parsing and subsequent execution of the
text of EXPR until run time.

In the second form, the code within the BLOCK is parsed only
once--at the same time the code surrounding the "eval" itself
was parsed--and executed within the context of the current Perl
program. This form is typically used to trap exceptions more
efficiently than the first (see below), while also providing the
benefit of checking the code within BLOCK at compile time.
OTRS-Erweiterungen (http://feature-addons.de/)
Frankfurt Perlmongers (http://frankfurt.pm/)
--

Unterlagen OTRS-Workshop 2012: http://otrs.perl-services.de/workshop.html
Perl-Entwicklung: http://perl-services.de/

View full thread Variablen in reg. Ausdrücken (s#$from#$to#g)