use warnings; use strict; print "What is your name?"; my $name = ; chomp $name; print "Hello, $name:)\n"; print "How old are you? "; my $age = ; chomp $age; print "You are $age years old!\n"; $age = $age / 2; print "Half your age is $age years.\n"; my $sum; { print "Enter a number... "; $sum = ; chomp $sum; if (! isNumber ($sum)) { print "Please use numrals.\n"; redo; } else { last; } } my $nextsum = $sum / 2; print "Half of $sum = $nextsum"; sub isNumber { my $value = shift; return $value =~ /^[.\d+-eE]+$/; }; print "\nTell me $name, would you like to try a test? Yes or No.\n"; { my $answer = ; chomp $answer; if ("no" eq lc ($answer)) { print "Oh well, have a good day!"; exit; } if ("yes" ne lc ($answer)) { print "Please answer yes or no $name\n"; redo; } } print "The question is: What is the square root of 36?\n"; my $answertwo = ; chomp $answertwo; print "Correct! Have a good day!" if "6" eq lc ($answertwo); print "Sorry, you're wrong. Have a good day!" if "6" ne lc ($answertwo); #### What is your name?your name Hello, your name:) How old are you? 34 You are 34 years old! Half your age is 17 years. Enter a number... 5 Half of 5 = 2.5 Tell me your name, would you like to try a test? Yes or No. yes The question is: What is the square root of 36? seven Sorry, you're wrong. Have a good day!