Hi.
What you should do is write both your new data and the contents of the old
file to a new file.
Afterwards, you might rename the new file to replace the old one.
Like:
#!/usr/bin/perl -w
open (NEWFILE, ">your new file's name") or die "Couldn't open new file: $!";
print NEWFILE $new_data;
# ... and so on ...
open (OLDFILE, "<your old file's name") or die "Couldn't open old file: $!";
while (chomp ($line = <OLDFILE>))
{
print NEWFILE "$line\n";
}
close OLDFILE;
close NEWFILE;
# And now, if you want:
rename "your new file's name", "your old file's name";
Sascha
At 03:41 15.08.01 -0400, you wrote:
>Help. How do I append data to the beginning of a file?
>
>
>--
>To unsubscribe, e-mail: [EMAIL PROTECTED]
>For additional commands, e-mail: [EMAIL PROTECTED]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]