in reply to while loop acting up, though I'm not sure how
What's going on, please, and why?
Rewrite the code so it tells you what is going on, its Basic debugging checklist
Basically start with something like this and run with it
use strict; use warnings; my $expiry = time + 3600; my $time; my $previoustime; #~ while ( 1 ) { for(1..10){ $time = time; my $and = $time + 300 < $expiry; my $or = $time - $previoustime >= 10; $or or my $orr = sleep (10 + $previoustime - $time); dd( [ time => $time], [ expiry => $expiry,], [ and => $and ], [ or + => $or, ], [ orr => $orr ] ); $previoustime = $time; warn $time; } __END__
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: while loop acting up, though I'm not sure how
by msh210 (Monk) on Nov 17, 2015 at 00:11 UTC | |
by Anonymous Monk on Nov 17, 2015 at 00:32 UTC | |
by msh210 (Monk) on Nov 17, 2015 at 00:58 UTC | |
by Anonymous Monk on Nov 17, 2015 at 01:10 UTC |