#!/usr/bin/perl5 use CGI; CGI::ReadParse(*vars); $|=1; # $|=1 makes output unbuffered... just a matter of personal preference print "Content-type: text/html\n\n"; # decide which page to display or action to perform based on the value of # the "page" CGI variable page1() if !$vars{'page'}; page2() if $vars{'page'} eq '2'; page3() if $vars{'page'} == 3; page4() if $vars{'page'} == 4; sub page1 { print <<"TheEnd"; The Bridge of Death

Who would cross the Bridge of Death must answer me these questions three, ere the other side he see.

What... is your name?

TheEnd ; } sub page2 { print <<"TheEnd"; The Bridge of Death
What...is your quest?
TheEnd ; print "\n"; # Yeah, I know there's really nothing to get from the user at this point print <<"TheEnd";
TheEnd ; } sub page3 { print <<"TheEnd"; The Bridge of Death
TheEnd ; if ($vars{'name'} eq 'Launcelot') { print <<"TheEnd"; What... is your favorite color?
TheEnd ; } elsif ($vars{'name'} eq 'Robin') { print <<"TheEnd"; What...is the capitol of Assyria?
TheEnd ; } elsif ($vars{'name'} eq 'Galahad') { print <<"TheEnd"; What... is your favorite color?
TheEnd ; } elsif ($vars{'name'} eq 'Arthur') { print <<"TheEnd"; What... is the air-speed velocity of an unladen swallow? TheEnd ; } print <<"TheEnd";
TheEnd ; } sub page4 { print <<"TheEnd"; The Bridge of Death TheEnd ; if ($vars{'name'} eq 'Launcelot') { print "Right. Off you go."; } elsif ($vars{'name'} eq 'Robin' || $vars{'name'} eq 'Galahad') { print "Auuuugh!"; } elsif ($vars{'name'} eq 'Arthur') { print "Huh? I-- I don't know that. Auuuuuugh!"; } print <<"TheEnd"; TheEnd ; }