my %params = map { $_ => $cgi->param($_) } $cgi->param; #### my %params; for my $name ($cgi->param) { my @values = $cgi->param($name); $params{$name} = @values > 1 ? \@values : $values[0]; }