Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

Re: Reopen file when contents changed?

by joelnackman (Beadle)
on Jun 07, 2005 at 14:12 UTC ( #464312=note: print w/replies, xml ) Need Help??

in reply to Reopen file when contents changed?

I'm not completely sure, but I think you should take a look at the Tie::File module. It allows you to treat a file like an array. Then you could just keep reading the first item in the array. Here's what it looks like:
use Tie::File; ... tie @data, Tie::File, $filename or die "Can't tie to $filename :$!\n";
The @data array would then contain the contents of the file, one entry per line. You could then just read $data[0], which would be the first line of the file. I think that it would update dynamically.

Tie::File Documentation

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2022-08-08 10:38 GMT
Find Nodes?
    Voting Booth?

    No recent polls found