Perl 101 (Part 3) - Looping The Loop (
Page 1 of 9 )
Part 3 in our continuing series on the popular scripting language, Perl. This week's article teaches you more about Perl's control
structures - including the FOR and WHILE loops - and also introduces you to
Perl's array variables.Last time, we introduced you to Perl's basic control structure - the
"if-else" family of conditional statements - and also taught you a little
more about scalar variables. This week, we're going to proceed a little
further down that same road, with a look at the different types of loops
you can use in Perl, an introduction to a new type of variable, and a
tongue-in-cheek look at the things modern managers do in the interests of a
fatter bottom line.
As always, we'll begin with a definition for those of you coming at this
series from a non-programming background. In geek-talk, a "loop" is
precisely what you would think - a programming construct that allows you to
execute a set of statements over and over again, until a pre-defined
condition is met.
Every programming language worth its salt uses loops - and, incidentally,
so do quite a few shampoo manufacturers. Think lather-rinse-repeat, and
you'll see what we mean...