in reply to Capture Contents AND Overwrite without Opening Twice?

Hey All,

So, I just gave the Tie::File module a try using AM's example, and it worked perfectly!

If I understand it correctly, "untie" will untie the array to the file (*unlocking the file), in
essence would that be the same as "closing" the file?

But anyway, thanks again everybody for the help.

Thanks,
Matt
  • Comment on Re: Capture Contents AND Overwrite without Opening Twice?

Replies are listed 'Best First'.
Re^2: Capture Contents AND Overwrite without Opening Twice?
by Anonymous Monk on Oct 09, 2014 at 19:10 UTC
    If I understand it correctly, "untie" will untie the array to the file (*unlocking the file), in essence would that be the same as "closing" the file?

    untieing a Tie::File array will close the file. However, Tie::File will not do any file locking for you unless you ask it to via its ->flock method (also make sure to read up on flock about its details and caveats, such as only being advisory locking). Your OS or FS might do some locking of its own, however on a normal *NIX system that's unlikely.

Re^2: Capture Contents AND Overwrite without Opening Twice?
by GotToBTru (Prior) on Oct 09, 2014 at 20:02 UTC

    dasgar suggested Tie::File.

    1 Peter 4:10

        Credit where credit is due. Nothing more.

        1 Peter 4:10