Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris

Re^3: Reopen file when contents changed?

by Thargor (Scribe)
on Jun 08, 2005 at 16:30 UTC ( #464745=note: print w/replies, xml ) Need Help??

in reply to Re^2: Reopen file when contents changed?
in thread Reopen file when contents changed?

When you open a file you have a pointer that points at the first line of the file. So I was just suggesting the OP might want to try just dupelicating that pointer and not changing what it points to while the original file pointer loops through the rest of the lines of the file reading in the data. I am slightly new to perl not sure if it would work. Hence it would be a static pointer, one that does not change, which is all the OP needs a constant pointer to the first line of the file. This would only be usefull if he isn't adding any information to the top of the file because the pointer would then not be pointing to the correct line.
  • Comment on Re^3: Reopen file when contents changed?

Replies are listed 'Best First'.
Re^4: Reopen file when contents changed?
by chb (Deacon) on Jun 08, 2005 at 21:44 UTC
    I think there was a misunderstanding. The combination of the words 'pointer' and 'static' made me think of a c-style static pointer, a thing that simply does not exist in perl. You are right, you would need something that addresses the beginning of the file. But that would be a fileposition, which is always 0 for the beginning of a file (kind of static...), so there is no need to store anything.

Log In?

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (7)
As of 2023-12-03 11:03 GMT
Find Nodes?
    Voting Booth?
    What's your preferred 'use VERSION' for new CPAN modules in 2023?

    Results (20 votes). Check out past polls.