Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Reading a file live!

by golux (Chaplain)
on Mar 07, 2014 at 19:38 UTC ( [id://1077447]=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
        my $len = (-s "file.txt") || 0;
        system ("perl eck.pl $var > file.txt &");
    ...
            my @newlines = read_new_lines("file.txt", $len);
            $len = $newlen;  # Adjust length to new end of file
        }
    
  2. or download this
        sub read_new_lines {
            my ($fn, $offset) = @_;
    ...
            chomp(my @lines = <$fh>);
            return (@lines);
        }
    

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2024-04-24 18:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found