Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re: Filehandles vs Uninitialized Values in pattern match

by johngg (Canon)
on Nov 23, 2007 at 16:18 UTC ( [id://652603]=note: print w/replies, xml ) Need Help??


in reply to Filehandles vs Uninitialized Values in pattern match

You might find it useful to have a look at Tie::File. This allows you to treat a file just as if it was an array. Thus, adding new lines at the end of the file is as simple as pushing onto the array. If the file is large you might not get great performance so YMMV.

I hope this is useful.

Cheers,

JohnGG

  • Comment on Re: Filehandles vs Uninitialized Values in pattern match

Replies are listed 'Best First'.
Re^2: Filehandles vs Uninitialized Values in pattern match
by erroneousBollock (Curate) on Nov 23, 2007 at 16:34 UTC
    If the file is large you might not get great performance so YMMV.
    That's probably not going to be much of an issue as (quoth the manual)

         The file is not loaded into memory, so this will work even for gigantic files.

    I don't know if Tie::File seeks from the end for large/negative indexes, but it's surely possible for it to do so.

    I just read the code... please ignore.

    -David

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (5)
As of 2024-04-19 23:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found