Just to clarify, you're trying to process GET/POST form variables. It can be done by hand without too much pain, but Perl is all about not reinventing the wheel. Every intro Perl/CGI book has a different way of doing this, but the answer you'll get from everyone here is using "all-singing, all-dancing"
CGI.pm. The module handles both HTML generation and form-processing, but you only need to pick out the functionality you want (I'd highly recommend all of it). It's maintained by Lincoln Stein, so the most current distro and doc is available
here. If you're still curious how to do it yourself, there's a
good Q&A post on the same topic.