http://qs321.pair.com?node_id=1002552


in reply to Re^4: trouble with regular expressions
in thread trouble with regular expressions

You can't do what you are trying to do with the file...unless you write out exactly the same number of characters as were there before. Usually instead you open a new file, write out all the lines (whether changed or unchanged) to it, then rename it to replace the existing file. For a quick script operating on only small files, you could use Tie::File to automate most of this for you.
--
A math joke: r = | |csc(θ)|+|sec(θ)|-||csc(θ)|-|sec(θ)|| |