in reply to Passing subroutines as arguments
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.
|
|---|