On Fri, 9 Aug 2002 [EMAIL PROTECTED] wrote: > Hi > > I have a text file that i want to insert two lines to the top of. > how do i do this?
>From the command line you can do this, this will retain you original file as filename~ perl -i~ -pe 'print "line1\nline2\n" if ($. == 1)' <your_text_file> If you want to do this from a perl file, open (YOURFILE, $your_file) or die "...."; open (TEMPFILE, ">backup.txt") or die "..."; print TEMPFILE "line1\nline2\n"; while (<YOURFILE>) { print TEMPFILE; } close (YOURFILE); close (TEMPFILE); rename ("backup.txt", $your_file); -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]