http://www.perlmonks.org?node_id=646055


in reply to text in header

Here's a node that discusses your problem in a nice detail: writing to the top of a file

non-Perl: Andy Ford