final<c> because that print is unconditional. You could write it that +way instead: <c> sub spl { my ($num1) = @_; my $total = 0; $total = $total + $_ for (split '', $num1); if (length($total) == 1) { print "Final: $total\n"; return $total; } else { return spl($total) } }
In reply to Re: Question on Recursion
by moritz
in thread Question on Recursion
by prasadbabu
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |