http://qs321.pair.com?node_id=2289


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
open FH , ">$output_file";
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 command
print FH "I will print this to a file\n";