Well a couple days ago I decided to test my extra-newbie perl skills and make a very insecure guestbook. Well any improvements that you would make then don't hesitate to post something on it. It helps alot. Thanks in advance.
#!/usr/bin/perl use CGI; $query = new CGI; print $query->header; print $query->start_html(-title => "Guestbook Thing"); print $query->h1("Guestbook Thing"); &writeit($query); &readit($query); &printit($query); print $query->end_html; sub writeit{ my($query)=@_; print $query->startform; print "Name:"; my $name = $query->param('Name'); my $comments = $query->param('Comments'); print $query->textfield(-name =>'Name'), "<BR>"; print "Message:<BR>", $query->textarea(-name => "Comments",-rows = +> "10",-columns => "50"),"<BR>\n"; print $query->submit(-value => "Submit"); print $query->reset(-value=>Reset); print $query->hr(); print $query->endform; open(WRITE,">>guestbook.txt") || dienice("AHH $!"); print WRITE "$name::$comments\n"; #wonders if he should use th +e join function here... close(WRITE) || dienice("AHH $!"); } sub readit{ open(WRITE,"guestbook.txt") || dienice("AHH $!"); while (<WRITE>){ @_ = @text; } close(WRITE); @done = split(/:/,@text); } sub printit{ print $query->h2('Current Results'); print $query->hr; print "Message By: $done[0]<BR>"; print "&lt;Message&gt;: <Br><blockquote>$done[1]</blockquote>&lt;/ +Message&gt;"; }

In reply to Test project.... by damian1301

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.