Are you aware of the following problems in your updated code?
Name "main::r1" used only once: possible typo at mytest.pl line 23. Name "main::rL3" used only once: possible typo at mytest.pl line 59. Name "main::OR1" used only once: possible typo at mytest.pl line 63.
These are the offending lines:
$r1 = $c; # $r1 Used only once. # .... $lambda_next = ($lambda_max + ($ks * $rL3)) * (1 - $kdeg); # $rL3 used + only once. # .... $cro_next = ($cro_max + ($ks * $OR1)) * (1 - $kdeg); # $OR1 used only +once.
The second and third cases are most alarming, since you're using $rL3 and $OR1 in computations while they (apparently) have undef as their values.
Update: As for efficiency, you could completely eliminate the inner loop, since the condition $cro < $cro_max will never be true, as you set $cro_max to zero at the top of your script. ...I suppose that won't do much for computational efficiency; a loop that never runs steals very few cycles. But it will save a few keystrokes.
Dave
In reply to Re: making code efficient
by davido
in thread making code efficient
by doozy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |