|
|
even better and simpler way
Perl has a solution ready made for you and it's built in and does what you want.
namely at the command line type:
Now in case that's too much trouble, just create an alias like this.
This will give you a perl interpreter at the command line that executes any commands you type in. THis saves you the hassle of having to type "print" before your entries or worrying about parentheses from confusing the print statement. All the usual math function like sine and cosine still function.
want fixed decimal places well then here you go:
This will give you 2 decimal places.
improved version:
Here's an improved version
This defines three variables $x, $y, and @z. results of the previous two commands, plus a stack of all the previous results.
even better and simpler way
You should look into the purpose behind taint checking before proceeding. Some of this eval() stuff can be dangerous! Imagine... blindly executing anything that a user types as input to a perl script! And if you don't get it, think about some of perl's builtin functions that don't do math. Like unlink(), maybe?
|
SearchFrom our Sponsor...Latest Mountain Lion HintsWhat's New:HintsNo new hintsComments last 2 daysLinks last 2 weeksNo recent new linksWhat's New in the Forums?
Hints by TopicNews from Macworld
From Our Sponsors |
|
Copyright © 2014 IDG Consumer & SMB (Privacy Policy) Contact Us All trademarks and copyrights on this page are owned by their respective owners. |
Visit other IDG sites: |
|
|
|
Created this page in 0.05 seconds |
|