in reply to Re: Question on Recursion
in thread Question on Recursion

JavaFan:

Not quite ... it'll only print the 9s! I'd suggest:

print "num=$num, result=", ($num ? substr("912345678", $num%9, 1) : 0) +, "\n";
...roboticus

Replies are listed 'Best First'.
Re^3: Question on Recursion
by JavaFan (Canon) on Jan 09, 2009 at 13:26 UTC
    Well, considering the OP has:
    print "$num == 9\n" if ($total1 == 9);
    only printing the 9s was done on purpose, as that's what the OP is doing.