Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

How do I append or write to the end of a file?

by vroom (Pope)
on Jan 08, 2000 at 08:46 UTC ( #1882=perlquestion: print w/replies, xml ) Need Help??

vroom has asked for the wisdom of the Perl Monks concerning the following question: (files)

How do I append or write to the end of a file?

Originally posted as a Categorized Question.

  • Comment on How do I append or write to the end of a file?

Replies are listed 'Best First'.
Re: How do I append or write to the end of a file?
by Crulx (Monk) on Jan 21, 2000 at 04:59 UTC

    open FH, ">>$output_file" or die "Couldn't open file: $!";

    Opens a file for appending.

    In an already open file for writing,

    seek FH,0,2;

    After you get to the end via those methods, simply

    print FH "What you want to print\n";

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2021-04-20 05:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?