Let me give you a little overview of what the following snippet of code is supposed to do: The script used to display the topics has two modes. If it's passed a topic ID through the topic parameter, it attempts to display that specific topic. If no parameters are passed to it, it displays a list of the topics available to read. The topic list is generated by listing all the files in the topic directory and extracting the title and author from those files. The topic IDs correspond to the names of the files in the topic directory. If the topic parameter is supplied, the full text of the topic is displayed. Each of the responses is displayed on the same page as the original topic, and a form used to respond to the topic is also displayed. The full source code appears below:
#!/usr/bin/perl use CGI; $query = new CGI; $topic_directory = "topics"; if($query->param('topic')){ $topic = $query->param('topic'); &file_error unless (&open_topic); &format_error unless (&parse_topic); &print_page_start; &print_topic; &print_response_form; print "<P>Return to the <A HREF=\"display.pl\">Topic list</A>.</P>\n"; &print_page_end; } else{ &page_title = "Topic Index"; &print_page_start; &print_topic_index; &print_page_end; } sub print_page_start{ print $query->header; sub print_topic_index{ eval{ opendir(TOPICS, "$topic_directory") or die "Can't open $topic_directory"; @topics = grep (/^.+\.txt$/, readdir (TOPICS)); foreach $topic (@topics){ $topic =~ s/(.+)\.txt/$1/; &open_topic; &parse_topic; print "<A HREF=\"display.pl?topic=$topic\">"; print "$page_title</A>, $topic_author<BR>\n"; } }; } ........ .......#<CODE HERE WAS OMITTED> The following code contains the form that holds the variable contents +for $topic The problem that I am having is I do not understand how the t +opic parameter in the form is passed a topic ID when it is a hidden field? + The code for the form creation is below: sub print_response_form{ print "<FORM METHOD=\"post\" ACTION=\"post.pl\">\n"; print "<INPUT TYPE=\"hidden\" NAME=\"action\" "; print "VALUE=\"response\">\n"; print "<INPUT TYPE=\"hidden\" NAME=\"response_to\" "; print "VALUE=\"$topic\">\n"; print "Author: "; print "<INPUT TYPE=\"text\" NAME=\"author\" "; print "SIZE=40 MAXLENGHT=72 VALUE=\"$author\"><BR>\n"; print "Message body: <BR>\n"; print "<TEXTAREA ROWS=10 COLS=60 NAME=\"post\"; print "WRAP=\"virtual\">"; print "......... .................................. .
Again I just don't understand how the parameter is assinged its value? Can anyone help me with this?

In reply to Help understanding this script by WarrenBullockIII

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.