On 10/15/07, Dr.Ruud <[EMAIL PROTECTED]> wrote:
> Jenda Krynicky schreef:
> > Dr.Ruud:
>
> >> [$version =~ s/^(Version:\s*(?:\d+\.)*)(\d+)/$1 . ($2+1)/e;]
> >>
> >> - you are using string evaluation. (read perlretut again)
> >
> > No I'm not. It's a single /e, not double /ee. The stuff inside the
> > matched string is not evaluated as Perl code. Read perlretut again.
>
> It is not about the match, but about the replacement.
>
> <quote source="perlretut">
> A modifier available specifically to search and replace is the "s///e"
> evaluation modifier.  "s///e" wraps an "eval{...}" around the replace-
> ment string and the evaluated result is substituted for the matched
> substring.  "s///e" is useful if you need to do a bit of computation in
> the process of replacing text.
> </quote>
>
> It says "replacement string", not "the code in the replacement string".

Also relevant is the section from perlop on s///:
                  A "/e" will cause the replacement portion to be
                  treated as a full-fledged Perl expression and
                  evaluated right then and there.  It is, however,
                  syntax checked at compile-time. A second "e"
                  modifier will cause the replacement portion to be
                  "eval"ed before being run as a Perl expression.

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to