goto

Perl supports a goto command. There are three forms: goto label, goto expr, and goto & name. In general, you shouldn’t need to use goto, which you’ll conclude if you do a search for goto in the comp.lang.perl.misc archives on http://www.dejanews.com.

The goto label form finds the statement labeled with label and resumes execution there. It may not be used to go inside any construct that requires initialization, such as a subroutine or a foreach loop.

The goto expr form expects the expression to return a label name.

The goto & name form substitutes a call to the named subroutine for the currently running subroutine.

Get Perl in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.