fusiondog has asked for the wisdom of the Perl Monks concerning the following question:
The situation: 60G HD, 40G file. No room to redirect standard out to a new file and/or make a backup. I thought, perl -i of course, but I get a counter point from a coworker that he believes it will still require extra disk space like sed -i. I've found an old article by merlyn from '98 that has an algorithm for "in place" that keeps a read pointer ahead of a write pointer in the same filehandle and then at end of the file, either truncate (and presumably in the perfected algorithm) concatenated to the end of the file as needed. And in my experiments adding a sleep to a perl -p -i -e, I see that the file size is set to 0 and no temp file is created in the working directory. Also in perldiag the following line strongly indicates that this is what is happening on on dos systems at least: Canít do inplace edit without backup (F) Youíre on a system such as MS-DOS that gets confused if you try reading from a deleted (but still opened) file. You have to say "-i.bak", or some such. --- Seems like I'm right, but I can't find any implementation details that explicitly confirm that. Can anybody confirm?