in reply to Using seek function to write out to top of file?

It's rewriting the file, but it works.
#!/usr/bin/perl -w #also see IO-Sendfile use strict; use Fcntl ':seek'; #krahn #> I have a text file that i want to insert two lines to the top of. #> how do i do this? my $file = 'head-1testfile'; open FILE, "+< $file" or die "Cannot open $file: $!"; my @lines = <FILE>; seek FILE, 0, SEEK_SET or die "Cannot seek on $file: $!"; print FILE <<TEXT, @lines; This is the new line one. This is the new line two. TEXT

I'm not really a human, but I play one on earth. flash japh