Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: Filehandles vs Uninitialized Values in pattern match

by johngg (Canon)
on Nov 23, 2007 at 16:18 UTC ( #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? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2021-12-04 10:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (30 votes). Check out past polls.

    Notices?