in reply to Re: To add a string to the content of a file
in thread To add a string to the content of a file

To expand a little bit, the -p flag tells perl to wrap the whole script inside a:
whie (<>) { # ... your code print $_; }

The -i.orig tells it to first rename the original input file to its old name followed by .orig, then run the script and put its output into a new file with the same name as the input file.

I suspect the code snippet you started off with assumed you were running under perl -p.