I am at a loss to understand how it works
I was, too... though I'm closer than I was when it was first posted. After some more experimenting and reading on the flip-flop, here's what I think is happening. $0 will always be true, and thus !$0 will always be false. So the flipflop statement is thus TRUE .. FALSE. Since perlop says, "The value returned is either the empty string for false, or a sequence number (beginning with 1) for true", then the .. will start counting up, and since !$0 is always false, will never stop counting.
My mental thinking is still wrong, however, because I'm still seeing an off-by-one error. On the second instance of that loop, I would expect the .. to return a 2, not a 1 -- as you showed, weird range was 2, but imax was 1...
In reply to Re^8: Why does my get_max_index function return zero? (High Water Mark Algorithm)
by pryrt
in thread Why does my get_max_index function return zero? (High Water Mark Algorithm)
by hghosh
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |