On 15 Oct 2007 at 20:43, Dr.Ruud 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.

Exactly. eval{}, not eval"". There is no dangerous string eval in 
that code.


Thanks for the \d info, I did not know they were silly enough to 
include some additional unicode characters in \d, I expected those to 
be only in the [[:IsNumber:]].

It's really sily as there really are characters that match /^\d$/, 
yet $char+0 issues a "Argument "..." isn't numeric in addition (+)" 
warning. And if I look at the characters that match \d it seems to 
include greek letters!


Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


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


Reply via email to