Answer:
see explaination
Step-by-step explanation:
Perl Program
#perl 5.22.1
#
# Hello World Program in Perl
#
$guss = 7;
$random_number = int(rand(100)) + 100;
print "Your name please: ";
my $name = <STDIN>;
chomp $name;
#print " '$random_number' ";
print "You Have 7 Gusses to Find Number\\";
print "Enter a number between 100 and 200\\";
my $num = <STDIN>;
chomp $num;
while( $guss > 0 )
{
if( $num == $random_number)
{
print ("Congratulations you Win the game in '$guss' gusses");
last;
}
elsif( $num < $random_number )
{
print ("Low Guss Try Again \\");
}
else
{
print ("High Guss Try Again \\");
}
my $num1 = <STDIN>;
chomp $num1;
$num = $num1;
$guss = $guss-1;
}
if($guss == 0)
{
print "You reached maximum gusses. Better Luck Next Time\\";
}
open(my $fh, '>', 'report.txt');
print $fh " '$name' '$guss'\\";
close $fh;
print "done\\";