Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: How do I write to a file?

by Crulx (Monk)
on Jan 21, 2000 at 04:54 UTC ( #2289=note: print w/replies, xml ) Need Help??


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";

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://2289]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2021-04-12 16:31 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?