On Feb 12, 2008 11:37 PM, <[EMAIL PROTECTED]> wrote: > I hope this isn't some horribly difficult task... > > Can a perl while loop be sped up faster than 1 second intervals? > > I recall something about various modules that allow time to be keep in > finer granularity but can things like unlink or whatever be made to > run faster than one second intervals. snip
You may want to look at the select* function or Time::HiRes**. You can call select with four arguments and get a timeout that is smaller than a second: while (1) { print localtime() . "\n"; select undef, undef, undef, 1/4; #sleep for a quarter of a second } You can also use the usleep function from Time::HiRes: while (1) { print localtime() . "\n"; usleep 1_000_000/4; #sleep for a quarter of a second } or even the nanosleep function from Time::HiRes: while (1) { print localtime() . "\n"; nanosleep 1e9/4; #sleep for a quarter of a second } * http://perldoc.perl.org/functions/select.html ** http://perldoc.perl.org/Time/HiRes.html -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] http://learn.perl.org/