You could use the cgi module to get the params
I hope I am not going to far with a homework help.
my $cgi = new CGI;
my %params = $cgi->Vars;
then loop through the hash %params, to get the submitted values you need and to clean them of potentially bad data.