Normally when you run a Perl script, the computer moves through each line of your script in turn, executing each line as it goes. However, often you’ll want to alter this flow through the script.
For example, you might want to run different pieces of code depending on whether a visitor has filled out a form correctly or not. Also, you often want to run the same piece of code lots of times – for example, when reading through each line of a file.
Perl features a number of useful ways to alter the path of execution through your script. In this tutorial I’ll show you the most common techniques, and how you can use them.