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; } } #### How many planets are there? 3 Sorry that's not right, try again. How many planets are there? 6 Sorry that's not right, try again. How many planets are there? 9 Well done! There are indeed 9 planets in the solar system.