in reply to
Number Guessing Game
my $random = int (rand(100));
$count = 0;
while ($random != $choice)
{
print "enter your choice = ";
$choice = <STDIN>;
$count++;
print "you entered= $choice";
if($choice == $random)
{
print "Bravo-------------------you win";
print "\nTotal number of counts= $count\n";
exit;
}
elsif ($choice gt $random)
{
print "\nyour choice is TOO High\n";
}
else
{
print "\nyour choice is too low\n";
}
print "\nto quit press q OR press enter to continue ";
$value = <STDIN>;
if($value eq "q\n")
{
print "Sorry!! you lost :-(\n";
print "\nTotal number of counts= $count\n";
exit;
}
}