Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re^2: Question on Recursion

by roboticus (Chancellor)
on Jan 09, 2009 at 13:23 UTC ( [id://735165]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://735165]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-04-20 05:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found