Multiple people have already given you your answer, but
nobody has actually told you how to
use CGI.
So here is a brief example of how you accept CGI input:
use strict;
Not really needed, but a good idea. See
strict.pm for
details.
use CGI qw/:standard/;
Loads
CGI and imports most of the functions you are
likely to want. The only one I am going to show you is
param().
my @parameter_list = param();
With no arguments it hands you back a list of all parameter
names you were called with.
my $text = param('textbox_name');
As for a single parameter in scalar context, and it gives
you back that parameter. If there were multiple entries,
it gives you just one.
my @selection = param('select_list_name');
Ask for a single parameter in list context, and it gives
you back all of the entries with that name. If you are not
familiar with the difference between list and scalar
context, then I would suggest calling the following function
in various places to see when you have list and scalar
context:
sub show_context {
if (wantarray()) {
print "List context\n";
}
elsif (defined(wantarray())) {
print "Scalar context\n";
}
else {
print "Boolean (scalar) context\n";
}
}
(It is explained in
perlsyn, but a little trial and
error generally helps to figure it out.)
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: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.