Perl functions references-goto Function - Perl Scripting

What is Perl goto function?

Description

This function consists of three forms, the first form causes the current execution point to jump to the point referred to as LABEL. A goto option in this form cannot be used to jump into a loop or external function. you can only jump to a point within the same scope.
The second form helps to EXPR in evaluating the LABEL which is to be recognised. In actual case, you should be able to use a normal conditional statement or function to control the execution of a program, so its use will get depreciated.
The third form substitutes a call to the named subroutine for the currently running subroutine. The new subroutine inherits the argument stack and other features of the original subroutine; it becomes impossible for the new subroutine analyse that it was called by another name.

Syntax

Following is the simple syntax for this function −

Return Value

This function does not return any value.

Example

Following is the example code showing its basic usage −
When above code is executed, it produces the following result −

All rights reserved © 2018 Wisdom IT Services India Pvt. Ltd DMCA.com Protection Status

Perl Scripting Topics