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);
Can be simplified, but it works.... |