Use until to read user input
#!/usr/bin/perl print "Are you o.k.? "; chomp($answer=<STDIN>); until ($answer eq "yes"){ sleep(1); print "Are you o.k. yet? "; chomp($answer=<STDIN>); }