in reply to Critique : Evaluating expressions.

I suggest PEMDAS and not simple left-to-right. You might also look at Math::Expr.

--
perl -pew "s/\b;([mnst])/'$1/g"

Replies are listed 'Best First'.
Re: Re: Critique : Evaluating expressions.
by shotgunefx (Parson) on Sep 25, 2002 at 08:09 UTC
    I probably will add correct precedence when I have less "real work" to do. I mainly did this as an exercise. It was a different type of problem then I normally solve.

    For me the grouping by parens and constructing an "op" tree was a real tricky problem so I just had to beat my head off the wall until I figured it out.
    Update
    Done PEMDAS ordered. Assignment propagates left. i.e a=b=c=10 will assign a,b,c the value 10.
    Code follows below.