in reply to Re: Confirming what we already knew
in thread Confirming what we already knew
to this:my $tv = mvsrt($cv, $oper, $amt);
(Well, that changes the actual operation each value of $oper performs, but you get the idea.)my $tv = ( ($cv <=> $amt) == ($oper - 1) );
Also, you have lots of C-style for loops which could be rewritten to use foreach. For example, change this:
to this:my $absMax = 0; for(my $i = $params[1] - 5; $i < $params[1]; $i++){ if($rddt[$i] > $absMax){ $absMax = $rddt[$i]; } } $returnValue = $rddt[$params[1]] - $absMax;
Foreach loops do tend to run quite a bit faster, and you have many of these.my $absMax = 0; # loop over array slice foreach my $rddt_value (@rddt[($params[1] - 5) .. $params[1]]) +{ if($rddt_value > $absMax){ $absMax = $rddt_value; } } $returnValue = $rddt[$params[1]] - $absMax;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Re: Confirming what we already knew
by AssFace (Pilgrim) on Mar 06, 2003 at 03:54 UTC | |
by perrin (Chancellor) on Mar 06, 2003 at 04:07 UTC |