use strict; use warnings; my $planet_count = "9"; while (1) { print "How many planets are there? "; chomp(my $planet_guess = <>); if ($planet_guess ne $planet_count) { print "Sorry that's not right, try again.\n"; next; } else { print "Well done! There are indeed $planet_count planets in the solar system.\n"; last; } }