use Errno qw( EINTR ); do { while (defined($line=$file->read)) { print $line; } } while $! != EINTR; # Go read from new file.