in reply to Passing Any Range of Values to a Sub

Congratulations on use of warnings and strict. You'll save much heartache down the road that way.

my $op = shift @ARGV; # first element of @ARGV now in $op and removed from @ARGV. print add(@ARGV) . "\n" if $op eq 'add'; print multiply(@ARGV) . "\n" if $op eq 'multiply'; # subs as before
Or you can get fancy and have a hash table of functions:
my $op = shift @ARGV; # first element of ARGV in $op and removed from @ARGV. my %h = ( add => \&add, multiply => \&multiply); print $h{$op}->(@ARGV) . "\n"; # subs as before


--Bob Niederman, http://bob-n.com