in reply to securely evaluating an expression

just a sidenote: (of course using eval in your context is extremely not secure, so you might want to change your code logic to include specific expressions: like if you want them to evaluate '5 < 7' then take the inputs each one alone and test them one by one to construct the expression, or something like that)
anyway
if (eval($expression)) { $output = $true; } else { $output = $false; }
using eval() will not tell you what went wrong, you probably want to use the eval-BLOCK to catch errors and warnings in $@.
eval { $expression }; $output = defined $@ ? $false : $true;

He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/