open (FH, "<filename.txt") || die "could not open file: $!";
@ODB = <FH>;
close (FH);
$newline = "The new line of text to go at the top of the file";
open (NFH, ">filename.txt") || die "could not open file 2: $!";
print NFH "$newline" . "\n";
foreach $line (@ODB) {
print NFH "$line";
}
close (NFH);
There are so many different ways to do it ... it is crazy to try and put them all here. The example above is ok, but if the file is very large, you might want to use join the data.
HTH,
- f o o g o d
--- ruining the bell curve for everyone else --- |