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
.



Relevant Pages

  • How to convert string to an expression in PERL or calculating numerical string
    ... got this string by replacing some text into 1' s and 0's. ... calculate this numerical expression and I need result for that. ... i want its value to be equal to '1'(by evaluating the ...
    (comp.lang.perl.misc)
  • IF statement using numerical expression with a text result
    ... I am trying to create a IF statement that will test a numerical expression ... that will result in a text string. ... but when I put the Excel object into a Word document, ... the page can't be changing or they freak out. ...
    (microsoft.public.word.tables)
  • Re: Timing BASIC code
    ... In BASIC you can do the above sort of shortcutting by ... evaluating B and C if A on its own would satisfy the test. ... On and off I've been writing a PDP-11 BASIC interpreter ... for reading a raw string and returning a string descriptor ...
    (comp.sys.acorn.programmer)
  • JEP - Java Expression Parser 2.3.1
    ... JEP is a Java API for parsing and evaluating mathematical expressions. ... formula as a string, and instantly evaluate it. ...
    (comp.lang.java.announce)
  • JEP 3
    ... JEP is a Java library for parsing and evaluating mathematical ... arbitrary formula as a string, ... Supports Boolean expressions ...
    (comp.lang.java.announce)