ЭЛЕКТРОННАЯ БИБЛИОТЕКА КОАПП |
Сборники Художественной, Технической, Справочной, Английской, Нормативной, Исторической, и др. литературы. |
3.10. Short SleepsProblemYou need to sleep for less than a second. SolutionUse the select(undef, undef, undef, $time_to_sleep); Some systems don't support a four-argument use Time::HiRes qw(sleep); sleep($time_to_sleep); DiscussionHere's an example of while (<>) { select(undef, undef, undef, 0.25); print; } Using Time::HiRes, we'd write it as: use Time::HiRes qw(sleep); while (<>) { sleep(0.25); print; } See AlsoThe documentation for the CPAN modules Time::HiRes and BenchMark; the |