Home arrow Perl Programming arrow Page 9 - Perl 101 (Part 3) - Looping The Loop

So Many Choices... - Perl

Part 3 in our continuing series on the popular scripting language, Perl. This week's article teaches you more about Perl's controlstructures - including the FOR and WHILE loops - and also introduces you toPerl's array variables.

  1. Perl 101 (Part 3) - Looping The Loop
  2. While You Were Sleeping...
  3. ...Or Until You Wake Up
  4. Dos And Don'ts
  5. For Pete's Sake!
  6. Every Comedian Needs An Exit
  7. Grade School
  8. Playing With Friends
  9. So Many Choices...
By: Vikram Vaswani and Harish Kamath, (c) Melonfire
Rating: starstarstarstarstar / 5
June 15, 2000

print this article


Now that you know all about Perl's control structures, you're probablywondering which one to use when. Well, this section will try to clear thatdilemma up for you.

* If you have a set of statements that need to be executed a number oftimes until a certain condition is met, but you have no idea what thatnumber is, the "while" and "until" loops are a good bet.

* If you have a set of statements that need to be executed at least once,the "do-while" and "do-until" loops are the ones to go with.

* If you need to execute a set of statements a specific number of times,pick the "for" loop and don't think twice!

* If you need to process every element of an array, go with the "foreach"loop.

Next time, we'll be teaching you a little more about array variables, andsome of Perl's more interesting array functions; we'll also take a look atPerl's file manipulation capabilities.

What will you do until then? Well, they're bound to be showing re-runs of"Friends" on your local cable channel...

This article copyright Melonfire 2000. All rights reserved.

>>> More Perl Programming Articles          >>> More By Vikram Vaswani and Harish Kamath, (c) Melonfire

blog comments powered by Disqus
escort Bursa Bursa escort Antalya eskort


- Perl Turns 25
- Lists and Arguments in Perl
- Variables and Arguments in Perl
- Understanding Scope and Packages in Perl
- Arguments and Return Values in Perl
- Invoking Perl Subroutines and Functions
- Subroutines and Functions in Perl
- Perl Basics: Writing and Debugging Programs
- Structure and Statements in Perl
- First Steps in Perl
- Completing Regular Expression Basics
- Modifiers, Boundaries, and Regular Expressio...
- Quantifiers and Other Regular Expression Bas...
- Parsing and Regular Expression Basics
- Hash Functions

Developer Shed Affiliates


Dev Shed Tutorial Topics: