in reply to Printing to a specific place in a file

Try :perldoc -q 'change one line'.

The general idea is that you can't change bytes in the middle of a file unless you are replacing existing data with replacement data that is exactly the same length.

Perl does have a concept of "in-place" editing that can make it appear like you are inserting bytes into the middle of a file, but it's actually rewriting the whole thing...see perldoc perlrun(specifically the -i switch), and perldoc perlvar (the $^I variable).

  • Comment on Re: Printing to a specific place in a file