in reply to Chomp a numerical expression, return the answer.
You want eval. But... you don't want it!
$ perl -lne "print eval" (7 * 3) + (2 + 1) 24
Now, to convince you that you don't want it, think about
"system 'rm -rf /'"
You may be interested in Safe.pm, but that's been reported not to be bullet-proof either.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Chomp a numerical expression, return the answer.
by suaveant (Parson) on May 18, 2006 at 16:17 UTC | |
|
Re^2: Chomp a numerical expression, return the answer.
by sub_chick (Hermit) on May 18, 2006 at 17:50 UTC |