http://www.perlmonks.org?node_id=601746

Spidy has asked for the wisdom of the Perl Monks concerning the following question:

Greetings, Fellow Monks.

For a recent project, users are encouraged to fill in a form with a varying number of fields - all of the fields have the same basic premise(being an answer to a question), but need to have some sort of way for me to retrieve all of them using CGI.pm. Users are able to dynamically add fields(which would also mean dynamically naming them), up to a possible limit of infinity or so. I know that I could name the fields 'answer<foo>', where <foo> is a number from 1..infinity and then just retrieve all of them, but I'm wondering: is there a better way that I can organize and retrieve these values? In my mind I'm thinking of an array of some sorts, but I'm not sure if that's actually possible.



Thanks,
Spidy


Edited Addendum: I am absolutely not going to use Javascript or Ajax to do this, as this feature is being developed for users that do not have Javascript disabled. Also, a PHP version of what I'm talking about can be seen here, if you look under "Creating a PHP array in an HTML form".