Hour 3. Controlling the Program's Flow
In Hour 2, "Perl's Building Blocks: Numbers and Strings," you learned about statements, operators, and expressions. All the examples in that hour had one thing in common: All the statements were executed in order from top to bottom and were executed only once.
One of the reasons that you use computers is that computers are very good at performing repetitive tasks—over and over again—without getting tired or bored and without developing carpal tunnel syndrome. So far, you haven't had any way of telling Perl to "do this task X times" or to "repeat this task until it's done." In this hour, you will learn about Perl's control structures. Using them, you can group statements into something called a statement ...
Get Sams Teach Yourself Perl in 24 Hours 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.