\$valid="false"; While (\$valid eq "false"){ #This is the 1st Line #User didn't enter anything. print "Please enter the number of tickets you want."; chomp(\$NumberOfTickets = ); if (\$NumberOfTickets ne ""){ \$valid = "true"; }else{ print "\nYou did not enter anything, enter a number."; Next; } #User didn't enter a digit if (\$NumberOfTickets =~ /[^0-9]/){ \$valid = "false"; print "\nYou should only enter a digit, enter a digit."; Next; }else{ \$valid="true"; } #Number of tickets should be between 1 and 10 if (\$NumberOfTickets > 10 || \$NumberOfTickets < 1){ \$valid="false"; print "\nYou can only have 1 to 10 tickets, reenter number."; Next; }else{ \$valid="true"; } #This is the 2nd Line #You can only have 6 numbers or less on a ticket. print "Please enter how many numbers you want on each ticket."; chomp(\$NumbersOnTickets = ); if (\$NumbersOnTickets <= "6"){ \$valid = "true"; }else{ print "\nYou can only have 1 - 6 tickets, reenter number."; chomp(\$NumbersOnTickets = ); Next; } if (\$NumberOnTickets ne ""){ \$valid = "true"; }else{ print "\nYou did not enter anything, enter a number between 1 - 6."; Next; } #User didn't enter a digit if (\$NumberOnTickets =~ /[^0-9]/){ \$valid = "false"; print "\nYou should only enter a digit, enter a digit."; Next; }else{ \$valid="true"; } #Number of tickets should be between 1 and 6 if (\$NumberOnTickets > 6 || \$NumberOfTickets < 1){ \$valid="false"; print "\nYou can only have 1 to 6 tickets, reenter number."; Next; }else{ \$valid="true"; } #This is the 3rd Line #Highest number must be less than or equal to 56 print "Enter the highest number you want on your tickets."; chomp(\$HighestNumberOnTicket = ); if (\$HighestNumberOnTicket <= "56"){ \$valid = "true"; }else{ print "\nYour highest number can between 1 and 56, reenter number."; chomp(\$HighestNumberOnTicket = ); Next; } if (\$HighestNumberOnTicket ne ""){ \$valid = "true"; }else{ print "\nYou did not enter anything, enter a number between 1 - 56."; Next; } #User didn't enter a digit if (\$HighestNumberOnTicket =~ /[^0-9]/){ \$valid = "false"; print "\nYou should only enter a digit, enter a digit."; Next; }else{ \$valid="true"; } #Number of tickets should be between 1 and 56 if (\$HighestNumberOnTicket > 56 || \$NumberOfTickets < 1){ \$valid="false"; print "\nYour hightest number can only be between 1 to 56, reenter number."; Next; }else{ \$valid="true"; } for (\$i=0; \$i<\$NumbersOnTickets; \$i++) { \$lotto[\$i]= int(rand(\$HighestNumberOnTicket)) + 1; } print "Your lottery ticket number is @lotto\n"; } }