You can set and retrieve CGI parameters easily. In these examples, the CGI field string is:
banana=yellow&squash=green&tomato=red&tomato=green
my $banana_color = param('banana');
# yields "yellow"
|
This works for both GET and POST types, including multipart/form-data.
Call param() with the name of the field and assign it to an array:
my @tomatoes = param('tomato');
# yields ('red','green')
|
Call param() without any arguments. Will return the names of each of the parameters:
my @fields = param;
# yields ('banana','squash','tomato')
|
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.
|
| Contents | Next |