in reply to Reading line from file only when there is a new line (live)
Why not take a slightly different approach. Constantly read the file, but only process complete lines. Something like this:
--my $buff; my $data; while (1) { if (read(MUFFINLOG, $buf, 1024)) { $data .= $buf; while ($data =~ /\n/) { my $line; ($line, $data) = split /\n/, $data, 2; # process the line of data that is in $line } } }
Perl Training in the UK <http://www.iterative-software.com>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: Reading line from file only when there is a new line (live)
by suaveant (Parson) on Sep 12, 2001 at 17:27 UTC | |
by davorg (Chancellor) on Sep 12, 2001 at 17:34 UTC | |
by Anonymous Monk on Sep 12, 2001 at 17:49 UTC |