more useful options | |
PerlMonks |
Re: while loop acting up, though I'm not sure howby Athanasius (Archbishop) |
on Nov 17, 2015 at 06:28 UTC ( [id://1147884]=note: print w/replies, xml ) | Need Help?? |
Hello msh210, The logic of your while loop condition is too complicated. Rearranging and simplifying, I came up with this, which seems to do what you want:
Output:
A side note: sleep returns the number of seconds slept (as an integer). So the condition:
could evaluate to zero — which is false — causing the loop to terminate prematurely. In my testing I don’t see this happening, but it’s still a logic error (a potential bug), and so a further reason to simplify the logic of the loop condition. Hope that helps,
In Section
Seekers of Perl Wisdom
|
|