Re: How to convert string to an expression in PERL or calculating numerical string



"rajesh" <sivarajesh.jarugula@xxxxxxxxx> wrote:

> HI,
> In PERL, I have a string $a=' ( ((1) && (0) && (0)) || (1) )
> '. I
> got this string by replacing some text into 1' s and 0's. Now I
> want to calculate this numerical expression and I need result for
> that. In normal case, the value of $a would be the same string,
> but in this condition, i want its value to be equal to '1'(by
> evaluating the expression). how to get that value by evaluating
^^^^
> the string as a numerical expression?


perldoc -f eval


--
Cheers,
Bernard
.