i got this code but when i tested it i got no result: if ($ARGV[0] eq "add") { $rtn = add($ARGV[1]); print " The sum is $rtn"; } elsif ($ARGV[0] eq "multiply") { $rtn = multiply($ARGV[1]); print "ther prod is $rtn"; } sub add{ my ($sum); $sum=0; foreach $_(@_) { $sum +=$_; } return $sum; } sub multiply { my ($multiply); $product=0; foreach $_(@_) { $product+=$_; } return $multiply: } am i doing it right?
In reply to Re^2: subroutines problem
by newly
in thread subroutines problem
by newly
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |