Common Statements Used in Perl

Now I’d like to briefly discuss some of the Perl language constructs that you’ll see throughout this book. If you’re already a Perl programmer, just skip the remaining sections of this hour. If you’re not, you’ll probably find these sections helpful as you read the rest of the book. Unfortunately, they won’t serve as a replacement for a book dedicated to Perl or the documentation provided with Perl.

First, let’s talk about the loops available in Perl. There are actually many types of loops that you can use in your Perl programs, but I’ll only use a couple of them in this book. The two loops I use most often are while and foreach. Let’s look at each of them in turn.

while loops are executed until a particular condition ...

Get Sams Teach Yourself CGI in 24 Hours, Second 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.