in reply to Re: Help with simple calculator script.
in thread Help with simple calculator script.
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.";
|
|---|