#!/usr/bin/perl # The following lines are included in all the scripts we write. # They make it much easier to process HTML form in Perl. require "cgi-lib.pl"; &ReadParse; # If the first radio button was checked, call the subroutine # (OutputHTML) which creates an HTML version of the mad lib. if ($in{'output_type'} eq "html") { &OutputHTML; } # If the second radio button was checked, call the subroutine # (OutputText) which creates a plain text version of the mad lib. if ($in{'output_type'} eq "plaintext") { &OutputText; } # If the third radio button was checked, go directly to Yahoo. if ($in{'output_type'} eq "vamoose") { print "Location: http://www.yahoo.com/\n\n"; } # ---------------------------------------------------------- # The "OutputHTML" subroutine sends an HTTP header with the # text/html MIME type, and a complete HTML page, using the # input from the mad lib form. sub OutputHTML { print "Content-type: text/html\n\n"; print< A World Wide Web Mad Lib

Here's the mad lib you created. Boy, you're weird.


Health Bulletin

Two $in{'adjective1'} studies in the current issue of the $in{'country'} Journal of Medicine $in{'adverb'} prove that prolonged exposure to $in{'nouns'} causes bizarre mutations of the $in{'bodypart'} in 9 out of 10 $in{'animals'} studied in the laboratory.

Dr. $in{'person'}, a spokesperson for the University of $in{'country'}, which sponsored the study, had this to say: "We think it's very important that the public be made aware of this $in{'adjective2'} hazard. At least $in{'number'} people have $in{'verbed'} already!" ENDOFTEXT } # ---------------------------------------------------------- # The "OutputText" subroutine sends an HTTP header with the # text/plain MIME type, and a text file with the filled-in # mad lib, using the input from the mad lib form. sub OutputText { print "Content-type: text/plain\n\n"; print<