in reply to How to exit subroutine and go to Beginning of CGI Script?

One method is to make the "main" part of your code into a subroutine itself such that to start at the beginning again, you simply call that routine. I find your request quite bizarre though. Why would you want to do this?

  • Comment on Re: How to exit subroutine and go to Beginning of CGI Script?

Replies are listed 'Best First'.
Re: Re: How to exit subroutine and go to Beginning of CGI Script?
by calin (Deacon) on Dec 19, 2003 at 19:27 UTC
    One method is to make the "main" part of your code into a subroutine itself such that to start at the beginning again, you simply call that routine.

    This will lead to memory exhaustion under some circumstances.

    Question: is tail-recursion possible in Perl?

      It could lead to memory exhaustion. But then there's always goto &main; (or more likely @_=(); goto &main;). This form of goto isn't quite as evil as goto LABEL or goto EXPR.

      P.S. Of course tail-recursion is possible, though not always desirable :)