in reply to regex and multiplication

Yes, add the /e switch:
$var =~ s/WORD\s(\d+)/"WORD " . (2 * $1)/e;
See perlre for details.

Cheers,
Ovid

Update: Fixed post in response to tye's clarification.

Join the Perlmonks Setiathome Group or just go the the link and check out our stats.

Replies are listed 'Best First'.
RE: Re: regex and multiplication
by tye (Sage) on Sep 21, 2000 at 20:27 UTC

    You should quote the parts of the replacement you don't want executed:

    s/WORD\s(\d+)/"WORD ".(2*$1)/e;

    Or, how I'd write it:

    s/(WORD\s)(\d+)/$1.(2*$2)/e;
            - tye (but my friends call me "Tye")