now i have the code completed -- but when a user guess the right number it keeps asking for the same guess again and again , my question is : how can i restart the program automaticaly with a new secret number but without quiting .
here is the code
#!/usr/bin/perl -w
use warnings;
use strict;
my $secret = int(1 + rand 100);
while(1) {
print "please enter a guess from 1 to 100: ";
chomp(my $guess = <STDIN>);
if ($guess =~ /quit|exit|^s*$/i)
{
print " sorry you gave up.the number was $secret.\n"; last;
}
elsif ($guess < $secret) { no strict;
print "you failed ,try higher\n";
}
elsif ($guess > $secret) {
print "you failed , try lower\n";
}
elsif ($guess == $secret) {
print "you got it\n";
}
}
Sorry again for the mistakes i made concerning where should i add my question , im new here and new for PERL in general.
cheers,