"until" is not a loop, it is a condition. What you want is "while". "while" is a loop and you can use loop commands to control the loop:
next
redo
last
The old standard for what you are doing is:
while(1){
...
}
heres a working example I recently posted on another forum:
use strict;
use warnings;
my $thinkingof = int(rand 10)+1;
while (1) {
print "Pick a number 1 to 10\n";
my $guess = <STDIN>;
chomp $guess;
if ($guess > $thinkingof){
print "You guessed too high\n";
next;
}
elsif ($guess < $thinkingof){
print "You guessed too low\n";
next;
}
print "YOU GUESSED RIGHT!! It was $guess\n";
last;
}
use strict;
use warnings;
my $thinkingof = int(rand 10)+1;
until (0) {
print "Pick a number 1 to 10\n";
my $guess = <STDIN>;
chomp $guess;
if ($guess > $thinkingof){
print "You guessed too high\n";
next;
}
elsif ($guess < $thinkingof){
print "You guessed too low\n";
next;
}
print "YOU GUESSED RIGHT!! It was $guess\n";
last;
}