Question on Recursionby prasadbabu (Prior)
|on Jan 09, 2009 at 10:49 UTC||Need Help??|
prasadbabu has asked for the wisdom of the Perl Monks concerning the following question:
I wrote the below code and found the final total is printing continuously. I expected only 9 but it is printing both 9 and 18 continuously. I solved the issue later (case 2). But I want to know the reason why it is printing continuously 9 and 18. Because of that I am not getting final output '1818 == 9' in the main program.
I 'super searched' in perlmonks and found following links. subroutine recursion question,Recursion problem, Recursion. But I was not able to find correct answer. Even I googled but I didn't get correct answer. Even I flushed using $| but not able to get expected output. Where am I going wrong? Could someone explain where I am making mistake?
Thanks in advance
updated: added the line, 'Because of that I am not getting final output '1818 == 9' in the main program.'