logo

internet.com
Join the free
WDVL newsletter!

home

foreach

foreach

  • Another very useful control statement is the foreach loop. The foreach loop iterates through some list and executes a statement block for each iteration. In CGI scripts, the foreach loop is most commonly used to iterate through a list array. For example, the following code snippet will print out the value of every element in the list array @names.

    foreach $name (@names)
           {
           print "$name\n";
           }
    

Additional Resources:

Using the if, elsif, else and unless Control Statements
Table of Contents
while

Up to => Home / Authoring / Scripting / Tutorial

Instantly look up a "techie" word using Webopedia!!


internet.com
e-commerce
WebDeveloper Network



Copyright 1999 internet.com Corporation. Legal Notices. Privacy Policy.

www.internet.com