> How can I read a string 5 - 4 and get 1?
Hallucinations may cause such strange errors.
If the string is really "5 - 4", and you get
"1" then your grey matter has failed. I
suggest updating to a more reliable version ;)
Oh, hang on... I know what you are talking
about now! You want to evaluate the string
"5 - 4", and the numerical result.
This is an area frought with security issues,
however this should be safe:
my $string = "5 - 4";
die "Invalid characters in string"
if $string !~ /^(\s|\d|[()\-\+\*\/])*$/;
print eval $string;
---
you'll need to modify it if you need taint mode.
This is restrictive for a reason, don't blindly
use eval without thinking first.
Jonathan Paton
__________________________________________________
Do You Yahoo!?
Everything you'll ever need on one web page
from News and Sport to Email and Music Charts
http://uk.my.yahoo.com
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]