Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #! /usr/local/bin/perl --
- print "content-type: text/html\n";
- chomp ( $input = <STDIN>);
- if ( $input =~ /stones=([^&]+)/ ) { $stones = $1 }
- $rnd = int(rand(20)) + 10;
- if ( $input =~ /re=/ ) { $stones = $rnd; }
- if ( $input =~ /take1=([^&]+)/ ) { $stones -= 1; }
- if ( $input =~ /take2=([^&]+)/ ) { $stones -= 2; }
- if( $input eq "" ) { $stones = $rnd; }
- print "<form method='post' action=''>\n";
- print "<input type='hidden' value='$stones' name='stones'>\n";
- if ( $stones > 0 ) {
- print "<input type='submit' name='take1' value='Take 1'><br><br>";
- if( $stones >= 2 ){ print "<input type='submit' name='take2' value='Take 2'><br><br>"; }
- } else {
- print "You win";
- }
- print "<input type='submit' name='re' value='Start Over'> ";
- print "</form>\n";
- print "</html>\n";
Add Comment
Please, Sign In to add comment