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". But you are right that it is quite doable to pre-compile the code above, so maybe perl-the-Perl-compiler does it like that. Let's test: $ perl -MO=Concise -e's/(abc)/length((($1)))/e' 7 <@> leave[1 ref] vKP/REFC ->(end) 1 <0> enter ->2 2 <;> nextstate(main 2 -e:1) v ->3 3 </> subst(/"(abc)"/ replstart->4) v ->7 6 <|> substcont(other->3) sK/1 ->(end) - <1> null sK*/1 ->6 - <@> scope sK ->- - <0> ex-nextstate v ->4 5 <1> length[t1] sK/1 ->6 - <1> ex-rv2sv sKP/1 ->5 4 <$> gvsv(*1) s ->5 -e syntax OK And you are right, the "length((($1)))" gets compiled. (see the line that starts with a 5) (tested with a perl 5.8.6) -- Affijn, Ruud "Gewoon is een tijger." -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/