zeni has asked for the wisdom of the Perl Monks concerning the following question:
Say it generates @expr = "((2 + 4 * 6 / 3) <= 20)"; or @expr = "((10 * 3)+(2 / 5) == 1)"; The whole expr will be stored in d form of a string. I need to evaluate this expression and validate it. N i want the "compiler" to solve it and return me d answer. Can this be possible? Plz help me as this is very imp.. Thanks In Advance !sub genRandomExpr { pickOperator(); pickRandomOperands(); formExpression(); return expr; } sub formExpression { createSubExprs(); merge(); return this; }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Solving an expression
by moritz (Cardinal) on Jun 13, 2009 at 08:10 UTC | |
by Jenda (Abbot) on Jun 13, 2009 at 16:16 UTC | |
by Anonymous Monk on Jun 15, 2009 at 04:20 UTC | |
|
Re: Solving an expression
by planetscape (Chancellor) on Jun 13, 2009 at 12:08 UTC | |
|
Re: Solving an expression
by ikegami (Patriarch) on Jun 13, 2009 at 22:23 UTC | |
|
Re: Solving an expression
by AnomalousMonk (Archbishop) on Jun 13, 2009 at 22:13 UTC |