in reply to Re: Simple add and multiply subroutines
in thread Simple add and multiply subroutines

Might as well toss this in, then:

... my $op = shift or die "You must specify an operation followed by numbe +rs.\n"; ########################################################### die "At least two numbers required.\n" unless @ARGV > 1; ########################################################### die "Non-numeric input.\n" if grep /\D/, @ARGV; ...

Despite jwkrahn's warning, I'd want to implement an "eval" wrapped around the operation, too - after carefully vetting the data. It's quite nice for those "Divide by zero" errors.


-- 
Human history becomes more and more a race between education and catastrophe. -- HG Wells