in reply to Perl overwriting some lines
...and the question is?
If you expect monks to help, you need to provide some input on which this doesn't work -- a minimal sample of it.