Stephen Redding wrote:
> 
> Hi

Hello,

> I have a text file that i want to insert two lines to the top of.
> how do i do this?


#!/usr/bin/perl -w
use strict;
use Fcntl ':seek';

my $file = 'text_file.txt';

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

__END__



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to