Well... the newbie is back. I'm using strict now, and surprise, surprise, it has generated numerous errors.
1. I'm trying to test if the user has hit the submit button yet, so, when the page first loads the value for if ($query->param('Action') eq 'Submit') is undefined. However, i get an uninitialized variable error. The code for this section:
my $query = new CGI; $query->param('Action') = "nothing yet"; #PRINT HEADER print $query->header; print $query->start_html( -title=>'Add to the Cancer Genomics Online Library'); # -script=>$JSCRIPT); #PRINT TITLE &print_title; #PRINT FORM print "<h2>Cancer Genomics Online Library Addition Form</h2>\n"; if ($query->param('Action') eq 'Submit') { # we have some data print "<h2>Entry Results</h2>\n"; # check data if (&check_entry($query) == 0) { &print_success($query); &make_entry($query); } else { print "<HR><H2>Errors Found</H2>\n"; print "<P>Please correct the errors above on the form below.\n +"; &print_form($query); } } else { &print_intro; &print_form($query); } &print_tail; print $query->end_html; #End of Program
How can I set $query->param('Action') to something?
2. This is really dumb, but I can't seem to create a file, open it, and then write into it. I keep getting ...print on closed filehandle main::PUBFILE ...
sub make_entry { my($query) = @_; my $PUBFILE = "temp.html"; open PUBFILE, ">$PUBFILE"; select STDOUT; my $pubtitle = $query->param('pubtitle'); my $pubauthor = $query->param('pubauthor'); my $pubdate = $query->param('pubdate'); my $pubjournal = $query->param('pubjournal'); my $pubcategory = $query->param('pubcategory'); my $puburl = $query->param('puburl'); my $pubkey1 = $query->param('pubkey1'); my $pubkey2 = $query->param('pubkey2'); my $pubkey3 = $query->param('pubkey3'); my $pubkey4 = $query->param('pubkey4'); my $pubcomments = $query->param('pubcomments'); #my $pubupload my $yourname = $query->param('yourname'); my $youremail = $query->param('youremail'); my $yourphone = $query->param('yourphone'); print PUBFILE <<END; <!-- \n $pubtitle \n $pubauthor \n $pubcategory \n $pubkey1 &amp;amp;amp;amp;nbsp $pubkey2 &amp;amp;amp;amp;nbsp &amp +;amp;amp;amp;pubkey3 &amp;amp;amp;amp;nbsp \n --> \n <table>\n <tr><td>Title: </td><td>$pubtitle</td><tr>\n <tr><td>Author: </td><td>$pubauthor</td><tr>\n <tr><td>Publish Date: </td><td>$pubdate</td><tr>\n <tr><td>Journal: </td><td>$pubjournal</td><tr>\n <tr><td>Category: </td><td>$pubcategory</td><tr>\n <tr><td>URL: </td><td><a href="$puburl">$puburl</a></td><tr>\n <tr><td>Keywords: </td><td>$pubkey1 &nbsp $pubkey2 &nbsp $pubk +ey3 &nbsp $pubkey4</td><tr>\n <tr><td>Comments: </td><td>$pubcomments</td><tr>\n <tr><td>Posted: </td><td></td><tr>\n </table> <table> <tr><td>Name of Poster: </td><td>$yourname</td><tr>\n <tr><td>Email of Poster: </td><td>$youremail</td><tr>\n <tr><td>Daytime Phone of Poster: </td>$yourphone<td></td><tr>\ +n </table> END close PUBFILE; }
Any ideas why?
Thanks... thanks for all of you guys who are answering and putting up with my dumb questions. It's saving my sanity!

In reply to using strict; lots more errors by newatperl

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.