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

*From*: "Bernard El-Hagin" <bernard.el-haginDODGE_THIS@xxxxxxxxxxxxx>*Date*: Wed, 23 Nov 2005 14:16:22 +0100

"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

.

**References**:

- Prev by Date:
**Re: Newbie trying to understand some perl code.** - Next by Date:
**Re: evaluate sine series.** - Previous by thread:
**How to convert string to an expression in PERL or calculating numerical string** - Next by thread:
**Newbie - Trying to extract all HTML tags from a text file** - Index(es):