The problem with Juerd's is that it offers no error checking. This one does:
perl -ple'$_=eval||$@||0'
For example:
vs.$ perl -ple'$_=eval' 1/0
$ perl -ple'$_=eval||$@||0' 1/0 Illegal division by zero at (eval 1) line 2, <> line 1.
-sauoq "My two cents aren't worth a dime.";
In reply to Re: Re: Help with simple calculator script.
by sauoq
in thread Help with simple calculator script.
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |