home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Perl CookbookPerl CookbookSearch this book

3.10. Short Sleeps

3.10.3. Discussion

Here's an example of select. It's a simpler version of the program in Recipe 1.6. Think of it as your very own 300-baud terminal.

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;
}


Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.