in reply to To add a string to the content of a file

If you invoked the script in some manner similar to:

myscript > myscript.pl

The first thing that will happen is that the shell will erase the file (or move the end of file marker to the beginning of the file, which is kind of the same thing)

Also, as noted by our beloved GrandFather and johnnywang your script isn't generating any output

corrected homenode links

emc