#!/usr/bin/perl use CGI qw(:standard); #Shakespear Lives! my $mode = param("mode"); if ($mode eq "palm") { print header; open(ONE,"/home/perlmonk/public_html/shakespear/one"); open(TWO,"/home/perlmonk/public_html/shakespear/two"); open(THREE,"/home/perlmonk/public_html/shakespear/three"); chomp(my @one = ); chomp(my @two = ); chomp(my @three = ); print "\n"; print "Thou "; my $one = $one[rand @one]; print $one; print " "; my $two = $two[rand @two]; print $two; print " "; my $three = $three[rand @three]; print $three; print <
Good
Okay
Bad
ENDFORM print ""; print ""; print ""; print < FINALE print ""; } if ($mode eq "gen") { open(ONE,"/home/perlmonk/public_html/shakespear/one"); open(TWO,"/home/perlmonk/public_html/shakespear/two"); open(THREE,"/home/perlmonk/public_html/shakespear/three"); chomp(my @one = ); chomp(my @two = ); chomp(my @three = ); print header; print <
Shakespear the talking head!

EOT print "Thou "; my $one = $one[rand @one]; print $one; print " "; my $two = $two[rand @two]; print $two; print " "; my $three = $three[rand @three]; print $three; print "

"; print "
"; print "
"; print "

So was that,"; my $option; foreach $option("good","okay","bad") { print "$option"; print ","; } print "or are you paralyzed by its brilliance so much that you can't click

"; print < END } if ($mode eq "eval") { my $one = param("one"); $one =~ s/\0//g; my $two = param("two"); $two =~ s/\0//g; my $three = param("three"); $three =~ s/\0//g; my $rating = param("rating"); if ($rating eq "good") { $/ = undef; open(ONE,"/home/perlmonk/public_html/shakespear/one"); my $checkone = ; if ($checkone =~ /$one\n/) { close(ONE); open(ONE,">>/home/perlmonk/public_html/shakespear/one"); print ONE "$one\n"; } open(TWO,"/home/perlmonk/public_html/shakespear/two"); my $checktwo = ; if ($checktwo =~ /$two\n/) { close(TWO); open(TWO,">>/home/perlmonk/public_html/shakespear/two"); print TWO "$two\n"; } open(THREE,"/home/perlmonk/public_html/shakespear/three"); my $checkthree = ; if ($checkthree =~ /$three\n/) { close(THREE); open(THREE,">>/home/perlmonk/public_html/shakespear/three"); print THREE "$three\n"; } } if ($rating eq "bad") { $/ = undef; open(ONE,"/home/perlmonk/public_html/shakespear/one"); open(TWO,"/home/perlmonk/public_html/shakespear/two"); open(THREE,"/home/perlmonk/public_html/shakespear/three"); my $listone = ; my $listtwo = ; my $listthree = ; close ONE; $listone =~ s/$one\n//; open (ONE,">/home/perlmonk/public_html/shakespear/one"); print ONE "$listone"; close TWO; $listtwo =~ s/$two\n//; open (TWO,">/home/perlmonk/public_html/shakespear/two"); print TWO "$listtwo"; close THREE; $listthree =~ s/$three\n//; open (THREE,">/home/perlmonk/public_html/shakespear/three"); print THREE "$listthree"; } print header; print"\n"; print "

So that was $rating, eh?"; print 'rate another '; print "

\n\n"; }