perl -e '
$a="token 1";
$a =~ /(\d+)/; 
use English; 
print $PREMATCH, $MATCH +10, $POSTMATCH, "\n";
'
 
Does this give you some ideas ?
 
jwm

-----Original Message-----
From: Sumit [mailto:[EMAIL PROTECTED]
Sent: December 05, 2003 15:56
To: [EMAIL PROTECTED]
Subject: evaluate perl code


Hi,
I have a regex in which I want to increment all matching numbers by some
value. Something like
$increment = 10
$string =~ s/(\d+)/$1+ $increment/g;
 
I tried the /e modifier (to evaluate perl code on the RHS of substitution)
but Perl complains on that
and gives me a compile error.
 
Any hints on this?
 
Thanks.

_______________________________________________
ActivePerl mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to