in reply to Re^2: How am i doing?
in thread How am i doing?

This node falls below the community's minimum standard of quality and will not be displayed.

Replies are listed 'Best First'.
Re^4: How am i doing?
by stevieb (Canon) on Jul 20, 2025 at 16:07 UTC
    If it's a recursion, it needs to be written as a for loop or some kind of loop. If you see that your sub-routine calls itself, double check that. That's often a program design error.

    You absolutely don't need a for() or any other type of loop to perform recursion. Recursion in and of itself kind of eliminates that need:

    use warnings; use strict; use feature 'say'; my $i = 0; recurse(); sub recurse { say ++$i; recurse() if $i < 5; }

    If the developer ends up with recursion where they didn't mean to, it's almost always a mistake, not a design flaw. A design flaw would be intentionally implementing recursion, but incorrectly (which most of the time crashes due to infinite recursion).

    There are very valid uses for recursion, and it works wonderfully when the proper checks and balances are put into place.

Re^4: How am i doing?
by choroba (Cardinal) on Jul 20, 2025 at 15:58 UTC
    > If it's a recursion, it needs to be written as a for loop or some kind of loop. If you see that your sub-routine calls itself, double check that. That's often a program design error.

    Can you tell us from where you got this advice? I taught programming for many years but I'd never encountered anything like that.

    map{substr$_->[0],$_->[1]||0,1}[\*||{},3],[[]],[ref qr-1,-,-1],[{}],[sub{}^*ARGV,3]
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re^4: How am i doing?
by Anonymous Monk on Jul 31, 2025 at 12:18 UTC
    If it's a recursion, it needs to be written as a for loop or some kind of loop. If you see that your sub-routine calls itself, double check that. That's often a program design error.

    🤣😂🤣😂🤣😂🤣