use strict; use warnings; use IO::Select qw( ); use Time::HiRes qw( time ); { open(my $fh, '>', 'log') or die; } { open(my $fh, '<', 'log') or die; my $sel = IO::Select->new($fh); my @times; push(@times, time); for (1..5) { push(@times, time); my @r = $sel->can_read(); push(@times, time); read($fh, my $buf='', 1000); } local $, = "\n"; local $\ = "\n"; print @times; } unlink 'log';