G'day georgecarlin,
The select(undef, undef, undef, $float_seconds); construct was a Perl4 (and earlier) solution for sleeping for fractional seconds.
The usleep() function of Time::HiRes has been available since 1996 (earliest CPAN reference I could find: Time::HiRes v1.02) and has been part of the Perl distribution since Perl v5.8.0 (perl58delta - what is new for perl v5.8.0). It should be available for your immediate use without requiring any installation or other activity on your part. If you're using an earlier version of Perl (perl -v on the command line will tell you), I'd recommend upgrading: v5.18.1 is the current version.
Add this line near the top of your code:
use Time::HiRes qw{usleep};
The usleep() function takes an argument in microseconds, so replace instances of
select(undef, undef, undef, 0.25);
with
usleep 250000;
You can do this in your current code, the ++solution provided by smis (above) or in whatever other solution you might choose.
[Update: Oops! I wrote "microseconds" and then provided a number in milliseconds: s/250/250000/]
-- Ken
In reply to Re: abstract expect call
by kcott
in thread abstract expect call
by georgecarlin
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |