View Single Post
Old Dec 23rd, 2005, 6:42 AM   #4
Arevos
Programming Guru
 
Arevos's Avatar
 
Join Date: Aug 2005
Location: England
Posts: 1,499
Rep Power: 5 Arevos is on a distinguished road
Quote:
Originally Posted by scuzzman
Thanks! Would changing this to a constant achieve my desired result, or would I need to just write a subfunction to repeatedly do the calculation?
A subroutine sounds your best bet:
sub findProd {
    my $level = shift @_;
    return (20 * $level) * (1.1 ** $level);
}

...

$level++ while (findProd($level) <= $goal);
Arevos is offline   Reply With Quote