http://qs321.pair.com?node_id=7246


in reply to Re: Writing to files
in thread Writing to files

I had better luck with this: perl -i -p -e 'print "first line\n" if $. == 1;' data It depends on the particular magic of $., of course.