03-03-2004, 09:48 PM | #1 (permalink) | |
Banned
Location: back to my old location
|
[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:
|
|
03-03-2004, 09:50 PM | #2 (permalink) | |
Psycho
|
Quote:
|
|
03-11-2004, 04:57 PM | #4 (permalink) | |
Darth Papa
Location: Yonder
|
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. |
|
Tags |
perl, powers |
|
|