Re: FW: question about recursion (pseudo-code if helpful)

2009-05-21 Thread Aaron Hawryluk
Wouldn't this work? Not that I know off the top of my head, but I've used similar structures in the past (not for heavy calculation work mind you, mostly for lexical parsing loops...) our $answer = recursive_function (initial parameter list); sub recursive_function { my $answer; some

FW: question about recursion (pseudo-code if helpful)

2009-05-21 Thread Greg Aiken
our $global_answer; recursive_function (initial parameter list); sub recursive_function { some stuff to do; do we have answer? if yes { $main::global_answer = ... return; else recursive_function (refined parameter list);

question about recursion

2009-05-21 Thread Greg Aiken
given: a. that its generally considered to be 'bad form' to use global variables inside of sub-routines. b. that I need to write a recursive sub-routine to solve a mathematical problem. the sub-routine will recursively call itself until the 'answer' is derived. when the innermost call finishe