in reply to Re: while loop acting up, though I'm not sure how
in thread while loop acting up, though I'm not sure how
That adds information, but I still don't see the bug. The output is
Use of uninitialized value $previoustime in subtraction (-) at soonix. +pl line 15. 1447773471 at MWE.pl line 22. before sleeping: time = 1447773471, $time = 1447773471, after sleeping: time = 1447773481, $time = 1447773471, 1447773471 at MWE.pl line 22. 1447773481 at MWE.pl line 22. before sleeping: time = 1447773481, $time = 1447773481, after sleeping: time = 1447773491, $time = 1447773481, 1447773481 at MWE.pl line 22. 1447773491 at MWE.pl line 22. before sleeping: time = 1447773491, $time = 1447773491, after sleeping: time = 1447773501, $time = 1447773491, 1447773491 at MWE.pl line 22. 1447773501 at MWE.pl line 22.
etc. The reason for the second warn each time around is (presumably) because mysleep doesn't get called i.e. because !($time - $previoustime >= 10) i.e. (presumably) because $time - 10 < $previoustime. But that's not the case: after all, we've set $previoustime = $time (which we were just warned is time - 10) and then $time = time. So I still don't get what's going on.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: while loop acting up, though I'm not sure how
by soonix (Chancellor) on Nov 17, 2015 at 20:40 UTC | |
by msh210 (Monk) on Nov 17, 2015 at 22:23 UTC |