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


Graphics & Media Lab. >> Библиотека | Курсы | Графикон

Hosted by Graphics & Media Lab
http://graphics.cs.msu.su
lab_logo
mailto: Laboratory