# Get the input... print "\nEnter the power (a positive integer from 1 through 9): "; chomp(my $power = ()); # Quietly end if there's no input... $power =~ m/\S/ or exit 1; # Validate the input... $power =~ m/^[1-9]$/ or die "$power is not a positive integer from 1 through 9\n";