|Perl: the Markov chain saw|
Re: I am a beginner for perlby cavac (Chaplain)
|on Oct 11, 2011 at 12:08 UTC||Need Help??|
First of all, the hashbang line (first line) shouldn't contain a space between the exclamation mark and the slash, so instead of
If my assumptions are correct so far, we could just remove variable $i altogether and just increment $j until the result is reached:
Of course, in this simple example, we could also provide a formula to do the same. In this case, instead of hardcoded numbers 10 and 2 i'll use $minimum and $stepsize:
While the last solution looks more complicated, it scales better. Think is you don't have 10 steps but 10 billion. The formula would still take the same time while the loop constructs will run for a long time.
Hope that helped to clarify a bit and i didn't misunderstand your problem.
Don't use '#ff0000':
use Acme::AutoColor; my $redcolor = RED();
All colors subject to change without notice.