http://qs321.pair.com?node_id=652603


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