View Full Version : Sorry, and also ???

08-22-2002, 01:20 PM
Sorry to be a pain, but I am trying to get to grips with this stuff and I am attempting to learn cgi/perl, forgive me for using this as a short-cut. What I want is something similar to this that appends the file rather than rewrites over it, so that each time it is accessed only the most recent submission is added in a new line of user input to the "results.txt" file.

open(OUT, ">/my_info/results.txt");
print "content-type: text/plain\n\n";

while (<>) {
print OUT $_;
print $_;
close (OUT);
exit 0;

08-23-2002, 06:43 AM
Instead of using ">" ... use ">>".


print DATA "HELLO";
close (DATA);

This is if you want to add it to the bottom of a text file.


Textfile BEFORE running the script:

my name
your name
his name
her name

Textfile AFTER running the script:

my name
your name
his name
her name

08-23-2002, 11:26 AM
It's that simple eh?

Sorry, I've come accross the '>>' before and it rang some kinda bells as soon as I read your reply. I must admit, there's a wonderful simplicity about perl that it quite compelling.

You have encouraged me to take a dive into my studies just a little bit further. I'm starting to see it's appeal now.

Thank you once again.