Your question has already been answered so I thought I'd throw in another way (there are more) to accomplish summing two cubes...
sub sum2cubes { my @cube = @_; # more meaningful than $a and $b return($cube[0] ** 3 + $cube[1] ** 3); } print sum2cubes(3,4);
Simplicity is one of Perl's finer points.
In reply to Sum of two cubes....
by Mr. Muskrat
in thread Passing subroutines as arguments
by mvaline
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |