![]() |
[perl] Powers!?! Where?
How do I get a number to be multipied by its power in perl?
Im trying to solve this equation, y=c(1+r)[to the power of]t but im stuck at where to multiply (1+r) by t. Heres the script so far: Quote:
|
Quote:
|
somthing like this maybe?
Code:
$one = 2; |
Quote:
You should instead be getting your input like this: chomp(my $cvar = <STDIN>); That'll chomp DURING the assignment. You also save a line, which is important when you're playing Perl Golf. And now that you know the ** operator, that formula should be a one-liner too. |
All times are GMT -8. The time now is 02:38 PM. |
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
Search Engine Optimization by vBSEO 3.6.0 PL2
© 2002-2012 Tilted Forum Project