in reply to Re: reading/writing to a file
in thread reading/writing to a file

AFAICT, this doesn't do what the OP wants, since it truncates the contents of $ARGV[2].

the lowliest monk