nenbrian has asked for the wisdom of the Perl Monks concerning the following question:
Hello Perl Monks,
I would like to be able to populate a Perl associative array with form values like this:
<input name="form_item{foo}" value="one"> <input name="form_item{bar}" value="two"> <input name="form_item{fiddle}" value="three">
I would like this to result in something like:
$hashref = $q->param('form_item');
And then be able to reference the values like this:
print $hashref->{foo}; # one print $hashref->{bar}; # two print $hashref->{fiddle}; # three
It seems that CGI.pm falls short of this, only allowing you to pass arrays, where the values are returned as a Perl list. Is there any way to get this type of functionality, short of rolling your own CGI package? (I've been warned not to do that!) :^)
Thanks,
-brian
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Populating a Perl associative array with form values
by davido (Cardinal) on Apr 29, 2004 at 00:00 UTC | |
|
Re: Populating a Perl associative array with form values
by TilRMan (Friar) on Apr 29, 2004 at 01:19 UTC | |
by nenbrian (Acolyte) on Apr 30, 2004 at 17:28 UTC | |
|
Re: Populating a Perl associative array with form values
by ccn (Vicar) on Apr 29, 2004 at 00:03 UTC |