in reply to How do I write to a file?
The open command opens a file. The first few characters of the second argument tell you how the file is opened.
This code
truncates and opens a file for writing. All the contents are lost.open FH , ">$output_file";
Opens a file for appending. When you start writing to this file, it will write to the end. To actually WRITE to that file you use the print commandopen FH, ">>$output_file";
print FH "I will print this to a file\n";
In Section
Seekers of Perl Wisdom