Setting & Retrieving CGI Parameters

You can set and retrieve CGI parameters easily:

Retrieve a Single-Valued Field Named "Tomato":

  my $tomato = param('tomato');

This works for both GET and POST parameters, including multipart/form-data.

Retrieve a Multi-Valued Field Named "Tomatoes":

  my @tomatoes = param('tomatoes');

Setting Single- and Multivalued Fields:

  param(-name=>'tomato',  -value=>'red');
  param(-name=>'tomatoes',-value=>[red green blue]);

Parameters set in this way will be used as default values for fill-out form fields and hidden fields.


<< Previous Contents >> Next >>

Lincoln D. Stein, lstein@cshl.org
Cold Spring Harbor Laboratory
Last modified: Fri Jun 18 08:18:11 EDT 1999