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


in reply to Writing to files

All the above good advice applies, but one liners are cool:
perl -i -p -e "BEGIN{print 'A new line!\n';}" your files here