in reply to updating a file

Reading and writting at same time is not supported. At least you cannot read it line by line and modify these lines because variable length of record. Also I don't remember exact place in the docs but if you switch from reading to writing or backwards you must reset current position with seek.

It is much more easier just make copy of this file (with File::Copy of course), open it for reading and open original file for writting.