in reply to Capture Contents AND Overwrite without Opening Twice?

A combination of open my $fh, '+<', ..., read, truncate $fh, 0; and seek $fh, 0, 0; (and then write) should do what you ask.

Replies are listed 'Best First'.
Re^2: Capture Contents AND Overwrite without Opening Twice?
by Anonymous Monk on Oct 08, 2014 at 19:28 UTC

    Make sure to read the docs: Check the return values of the functions (... or die "truncate failed"; etc.), and note that truncate has some kinks in Windows.