final because that print is unconditional. You could write it that way instead: 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) } }