in reply to Re: Algebraic Expansion of Binomials Using a Recursive Subroutine
in thread Algebraic Expansion of Binomials Using a Recursive Subroutine
Refactoring your refactoring just a tad…
# Get the input... print "\nEnter the power (a positive integer from 1 through 9): "; chomp(my $power = (<STDIN>)); # 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";
|
|---|