Jump Keywords

Domain Hosting image
Web Hosting
Dedicated server
ssl certificate
Web Design image
Email

Perl has four keywords that let you change the flow of your programs. Perl's Jump Keywords Keywords

last - Jumps out of the current statement block.
next - Skips the rest of the statement block and continues with the next iteration of the loop,
redo - Restarts the statement block.
goto - Jumps to a specified label.

Last Keyword

The last keyword is used to exit from a statement block. This ability is useful if you are searching an array for a value. When the value is found, you can stop the loop early.

Next Keyword

The next keyword lets you skip the rest of the statement block and start the next iteration. One use of this behavior could be to select 'specific array elements for processing and ignoring the rest.

Redo Keyword

The redo keyword causes Perl to restart the current statement block. Neither the increment/decrement expression nor the conditional expression is evaluated before restarting the block. This keyword is usually used when getting input from outside the program, either from the keyboard or from a file. It is essential that the conditions that caused the redo statement to execute can be changed so that an endless loop does not occur. The redo statement is rarely used. It is safe using 'last' to get out of a loop at the end or "next" to jump back up to the top.

Goto Keyword

The goto statement lets your program jump directly to any label. However, because Perl also provides the loop statements and other jump keywords, its use is looked down on by most programmers. Using the goto in your programs frequently causes your program logic to become convoluted. If you write a program that, you feel needs a goto in order to run, then use it but first, try to restructure the program to avoid it.



Domain Name Search

www.


Copyright (C) 2007. Web Domain design hosting. All rights reserved.