In my script, I am trying to take the user's input, use CGI.pm to sort out the data, then write that data to a file, with other data. Here is my script.
#!usr/bin/perl #Start the CGI! use CGI; #Declare a new page for the information my $Page = new CGI; #Put the data from the form into variables my $Name = $Page->param(Name); my $E_mail = $Page->param(E-mail); my $Comment = $Page->param(Comment); #A little bit of environment variables my $Browser = $ENV{"HTTP_USER_AGENT"}; #Open the file where the information will go. open(GUEST, '>>../GuestBook/GuestBook.txt') or die "The file could not + be opened."; #Open up the file for the counter to... "count" the people open(COUNT, '../Counter/counter.txt') or die "The File could not be op +ened."; #Save the contents to a variable $Number = <COUNT>; print COUNT $Number++; #Close it up close(COUNT); #Print all of the information, with the proper #HTML, to the file. print GUEST <<GuestStuff; <table border="0" cellspacing="1" cellpadding="0"> <tr width="200"> <td> <p style="size: 30px;">Otaku \#$Number.</p> </td> </tr> <tr> <td class="Cell"> <p style="color: white;">Name: $Name</p> </td> </tr> <tr> <td class="Cell"> <p style="color: white;">E-mail: $E_mail</p> </td> </tr> <tr> <td class="Cell"> <p style="color: white;">Comment: $Comment</p> </td> </tr> <tr> <td clas="Cell"> <p style="color: white;">Your Browser type: $Browser</p> </td> </tr> </table> GuestStuff #Print the HTML MIME header from CGI. print $Page->header; #Print to the screen print <<HYPERSTUFF; <html> <head> <title> Thank you! </title> <META HTTP-EQUIV="Refresh" CONTENT="10; URL=http://storm.prohosting.c +om/ertain"> <LINK REL="stylesheet" HREF="Style.css" TYPE="text/css"> </head> <body> <p>Thank you for your input! It will be on the GuestBook page, if y +ou want to see it. You will now be redirected to the main page.</p> <p>If it doesn't work in 10 seconds, here's the <a href="http://storm.prohosting.com/ertain">link</a>. </p> </body> </html> HYPERSTUFF #close the GuestBook file close(GUEST);
As you can see, the information is taken from the module, placed into variables, then is placed amongst the HTML, and written to a file. But I can't seem to get it to work.

In reply to Writing to a file by Anonymous Monk

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.