in reply to Re: begining of a file
in thread begining of a file
Can be simplified, but it works....open (FILE,"<file") || die "Could not open file : $!\n"; @contents = <FILE>; $head = shift(@contents); close(FILE); $new_entry = 'Welcome to www.perlmonks.org'; open (FILE, ">file") || die "Could not open file : $!\n"; unshift (@contents,$head,$new_entry); print FILE "@contents\n"; close(FILE);
|
|---|