Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Line by line buffered read

by rowdog (Curate)
on Aug 22, 2010 at 20:56 UTC ( [id://856609]=note: print w/replies, xml ) Need Help??


in reply to Line by line buffered read

As Ikegami pointed out, sysread is unbuffered io and I see no reason to use it here. It's much easier to use the buffered io functions and here's a simple revision of your example code that does just that.

#!/usr/bin/perl use strict; use warnings; my $fname = '/var/log/Xorg.0.log'; open my $fh, '<', $fname or die $!; while ( my $line = <$fh> ) { print $line; sleep 1; }

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://856609]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others musing on the Monastery: (2)
As of 2026-02-11 13:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.