in reply to $variables when retrieving cgi params

A useful snippet to gather all form values from variable names:

my %form_data = map { $_ => form_data($cgi,$_) } @form_names; sub form_data { my ($cgi,$name) = @_; my @data = $cgi->param($_); return $#data ? \@data : $data[0]; }

If there is only one value for a name, it is returned as a scalar. If there are multiple values, it's returned as an array reference.

Cheers,
Ovid

New address of my CGI Course.
Silence is Evil (feel free to copy and distribute widely - note copyright text)