A
Anand
After looking at a number of sources which have little to say on appending
to a file I came up with the following piece of code to append a sentence to
a file:
#!/usr/bin/perl
#open(FILE, ">>test1.html") || die $!;
#print FILE "This is a test line added to the file, <br>\n";
$line_to_write="I've appended a line to a file !";
$file_name="test1.html";
open(DAT,">>$file_name");
print DAT "$line_to_write\n";
close(DAT);
The commented and uncommented sections do the same thing though, they create
a second file without the .html extender rather than appending to
test1.html. What am I doing wrong here?
A.
to a file I came up with the following piece of code to append a sentence to
a file:
#!/usr/bin/perl
#open(FILE, ">>test1.html") || die $!;
#print FILE "This is a test line added to the file, <br>\n";
$line_to_write="I've appended a line to a file !";
$file_name="test1.html";
open(DAT,">>$file_name");
print DAT "$line_to_write\n";
close(DAT);
The commented and uncommented sections do the same thing though, they create
a second file without the .html extender rather than appending to
test1.html. What am I doing wrong here?
A.