Greetings,
I am writing a solving function. You pass it the name of a function and it
calls the functions many times until it finds the value that returns zero. How would
this be set up?
sub plusthree { # the function we are solving for
my ($x) = @_ return $x + 3; }
sub solve { # the solving routine my ($function) = @_;
......
$z = 0;
# calls passed function with parameter $z
$a = &{$function}($z);
}
#using solver to solve our function.
$answer = &solve( \&plusthree );
Thank you,
Joe.
