CGI

use CGI qw(:standard);
$who   = param("Name");
$phone = param("Number");
@picks = param("Choices");

The CGI module helps manage HTML forms, especially multistage forms where passing state from one stage to another is critical. The extremely simple example above expects to process a form with two parameters that take single values, such as text fields or radio buttons, and one that takes multiple values, like scrolling lists specified as "MULTIPLE". The module is several orders of magnitude fancier than this, supporting such features as convenient cookie processing, persistent values for multiscreen shopping carts, and dynamic generation of HTML lists and tables you might pull from a database—just to name a few. Support for turbo-charged execution of precompiled Perl scripts through Apache's mod_perl facility is also provided. The O'Reilly book Writing Apache Modules with Perl and C, by Lincoln Stein and Doug MacEachern, can tell you all about this.

Get Programming Perl, 3rd 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.