On Mon, Jun 09, 2003 at 04:53:53AM -0500 christopher j bottaro wrote:

> i want to do something like:
> $line =~ s/M (\d+) (\d+)/M $1+100 $2+200/;
> obviously adding 100 to $1 and 200 to $2, not adding the text '+100' and 
> '+200'.

Use the /e modifier and turn the substitution side into a valid Perl
expression that returns the desired output:

    $line =~ s/M (\d+) (\d+)/"M " . ($1+100) . " " . ($2+200)/e;

/e will make perl execute the right side and put in the result of this
execution.

Tassilo
-- 
$_=q#",}])!JAPH!qq(tsuJ[{@"tnirp}3..0}_$;//::niam/s~=)]3[))_$-3(rellac(=_$({
pam{rekcahbus})(rekcah{lrePbus})(lreP{rehtonabus})!JAPH!qq(rehtona{tsuJbus#;
$_=reverse,s+(?<=sub).+q#q!'"qq.\t$&."'!#+sexisexiixesixeseg;y~\n~~dddd;eval


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to