in reply to Reading a file before clobbering it for output...

This doesn't truncate the file before it gets read in. You're missing a ';' on your 'unshift' line so this shouldn't even compile. Your code above doesn't replace the contents of the file, it just appends to it (kind of).

Run perldoc on "truncate" and "seek" to find out how to remove the old content after reading.

  • Comment on Re: Reading a file before clobbering it for output...