[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Evaluating expressions with regexp



On Mon, Dec 06, 1999 at 02:12:27PM +0100, Peder Axensten wrote:
> I want to evaluate expressions in an text, the expressions are in the form:
> <#execute:(expression)#>, like <#execute: 933.47+273#>.
> 
> I am using "s/<#execute:(.*?)#>/\1/goe" to find and evaluate this and 
> it works -- kind of.
> Problem is it evaluates to "SCALAR(0x8b9159c)" instead of just plain "1206.47".
> 

Evaluating a scalar reference to the constant 1 is not generally useful.  ;)

/o is unneeded, because your regular expression is constant.

One /e is only enough to evaluate $1; to evaluate the expression contained
in $1, you need a second /e.


Try this instead:

s/<#execute:(.*?)#>/$1/gee

Ronald

# ===== Want to unsubscribe from this list?
# ===== Send mail with body "unsubscribe" to macperl-request@macperl.org