memoize is your friend! There is a whole chapter devoted to it in
"Higher order Perl" and yes Perl's recursion sucks especially when using
dynamically allocated large data structures!
Gaurav Vaidya wrote:
Hi Greg,
2009/5/22 Greg Aiken <gai...@visioninfosoft.com>:
the sub-routines then look to the value of $main::weve_found_answer to
determine if it should stop recursively calling itself because the answer
has already been found – or continue to recursively call itself again.
[..]
so I ask… ‘is there a better way of allowing each sub routines
instantiation, at any nested level of the recursive call, be able to know
when the answer has been found?’
Why don't you just exit once the answer has been found?
if($answer_found) { print "Answer: $answer"; exit 0; } else { recurse(); }
As Brian Raven said, a code sample would also be helpful, so we can
see if there's a good reason for you _not_ to just exit and leave at
this point.
cheers,
Gaurav
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
begin:vcard
fn:Angelos Karageorgiou
n:Karageorgiou;Angelos
org:Vivodi Telecommunications S.A.
email;internet:ange...@unix.gr
title:Technology Manager
tel;work:+30 211 7503 893
tel;fax:+30 211 7503 701
tel;cell:+30 6949120773
note;quoted-printable:=0D=0A=
=0D=0A=
Linkedin Profile =
=0D=0A=
http://www.linkedin.com/in/unixgr=0D=0A=
=0D=0A=
=0D=0A=
=0D=0A=
Personal Web Site=0D=0A=
http://www.unix.gr=0D=0A=
=0D=0A=
=0D=0A=
Blog Site=0D=0A=
http://angelos-proverbs.blogspot.com
x-mozilla-html:FALSE
url:http://www.linkedin.com/in/unixgr
version:2.1
end:vcard
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs