Day 6. Conditionals and Loops

Finally, we come to conditionals and loops! You've already learned a fair amount about the more popular conditional, if, and about while loops, so you might have already deduced that conditionals and loops are used to control the execution of blocks of statements in Perl script. Without these structures, your script would run from top to bottom, executing each statement in turn until it got to the end. No testing to see if a value is true, and then branching to a different bit of code; no repeating the execution of a block of statements a number of times. Scripts would be very boring indeed without conditionals and loops. They're so important you had to actually start learning about them two days ago, before we even ...

Get Sams Teach Yourself Perl in 21 Days, 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.