in reply to Multiple form selections in cgi
The param method, when called with no arguments, returns a list of the names of all the CGI parameters.
foreach ($cgi->param()) { if (/^year_\d+$/) { push(@years, $cgi->param($_)); } }
which can be rewritten as follows:
@years = map { $cgi->param($_) } grep { /^year_\d+$/ } $cgi->param();
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Multiple form selections in cgi
by punch_card_don (Curate) on Sep 26, 2005 at 19:09 UTC | |
by friedo (Prior) on Sep 26, 2005 at 19:32 UTC |