1. Create a new script with this code:

    #!/usr/bin/perl
    print "Content-type: text/html\n\n";

    &getFormData;

    $mycomments = $request{"comments"};
    $myfile = $request{"filename"};

    open(MYFILE,">$myfile");
    print MYFILE "$mycomments";
    close(MYFILE);

    print "<p>The $myfile file is created with the following thought:</p>";

    print "<p>$mycomments</p>";
    print "<p>$myfile</p>";

    print "<a href=\"http://www.yourwebsite.com/textwriter.html\">Enter a new thought</a><br>\n";

    print "<a href=\"$myfile\">View the $myfile text file</a>\n";

    sub getFormData {

    read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    @pairs = split(/&/, $buffer);
    foreach $pair (@pairs) {
    ($name, $value) = split(/=/, $pair);
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0- 9])/pack("C", hex($1))/eg;
    $value =~ s/\n/ /g;
    $request{$name} = $value;
    }
    }