in reply to corruption.

Hi.

You are opening the file for appending. Try opening it for read-write ("+<" instead of ">>").
See perlfunc:open for more info.
Hope this helps.

-JAS