Decoding Form Data via CGI.pm

The most common usage of CGI.pm is to decode form data. In fact, in many CGI programs, that’s all it’s used for. As soon as you import the CGI.pm module, all the input from the form is automatically translated and made accessible through the param method.

In most cases, the translation from form field to Perl variable is obvious. A group of radio buttons called favorite_color is accessible through param('favorite_color'). A text input field called name is accessible through param('name'). There are three special cases that merit individual discussion when it comes to translating form input into a Perl data structure. These three cases are image input fields for which names are specified, select lists that allow ...

Get Sams Teach Yourself CGI in 24 Hours, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.