#!/bin/perl
use strict;
use warnings;

srand;
my $number = int(rand(100)) + 1;
print "Guess on a number between 1 and 100\n";
my $guess = 0;
my $times = 0;

while ( $number != $guess ) {
    print "Your guess: ";
    $guess = <STDIN>;
    $guess =~ s/\n//;
    $times++;

    if ( $number > $guess ) {
	print "The number is bigger\n";
    } else {
	print "The number is smaller\n";
    }
}

print "It did take you $times tries to find the number.\n";
exit 0;
