Thank you again. I'm still not sure what was wrong with my original code, but using a subroutine has helped; thus:
use strict; use warnings; my $expiry = time + 3600; my $time = time; sub sleepy { my $oldtime = pop; my $newtime = time; my $diff = $newtime - $oldtime; sleep 10 - $diff if $diff < 10; return 1; } while ( (sleepy $time) and $time + 300 < $expiry ) { $time = time; warn $time; }
In reply to Re^4: while loop acting up, though I'm not sure how
by msh210
in thread while loop acting up, though I'm not sure how
by msh210
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |