in reply to read and write to the same file

Hi,
To open a file in update mode you should use
open(FH, "+< file1) or die "Opening: $!";

si_lence