chomp($guess = ); #### Name the definitive rock band.. The Who You Suck! What is their best song? Moonlight Mile You Suck! What is their best album? Sticky Fingers You Suck! You Rock! #### #!usr/bin/perl use strict; my @questions = ("Name the definitive rock band.." , "What is their best song?" , "What is their best album?"); my @correct = ("The Rolling Stones" , "Moonlight Mile" , "Sticky Fingers"); my $grade = 100 - length(my @incorrect) * 33.3; my @incorrect; my $i = 0; my $guess; # This program asks user three questions, then grades the user's answers. while ($i <= scalar(@incorrect)) { # loop through questions print $questions[$i] . "\n"; chomp($guess = ); $i++; if ($guess eq $correct[$i]) { # if guess is correct, reply print "You Rock!\n"; $i++; } else { print "You Suck!\n"; # if guess is incorrect, reply and save answer to be calculated @incorrect = (@incorrect, $guess); #while ($guess ne @correct[$i]) { # if guess is incorrect, prompt user to try again # print "Try again!\n"; # chomp($guess = ); # $i++; # } # end while } # end if } # end while print $grade . "\n"; # calculate and print user's grade print "\nRockstar Programming Inc. All Rights Reserved"; #### my @correct = qw / 1 2 3 4 5 6 7 8 9 10 /;