more useful options | |
PerlMonks |
Re^2: Tracking minimum of values in an array over timeby liverpole (Monsignor) |
on Oct 05, 2011 at 19:36 UTC ( [id://929865]=note: print w/replies, xml ) | Need Help?? |
What ++suaveant said.
I wrote the program below to illustrate how you might do this. Note that you increment your "check" variable (in my program it's called $nfloor) only when an element becomes exactly the "floor" value. You can change the value of $b_slow to zero to make it call the subroutine fast() instead of slow(), and play with the values of $array_size and $floor to see how they affect the overall program speed. ($b_debug, if set, prints out the array each time; you probably only want to do this if $array_size and $floor are both quite small!):
s''(q.S:$/9=(T1';s;(..)(..);$..=substr+crypt($1,$2),2,3;eg;print$..$/ An error has occurred. The site administrators have been notified of the problem and will likely soon fix it. We thank you, for you're patients.
In Section
Seekers of Perl Wisdom
|
|