InMotion Web Site Hosting
InMotion Hosting Home




Node:The for Structure, Next:, Previous:The do while/until Structures, Up:Control Structures



The for Structure

The for structure works similarly to the for structure found in C, C++ or Java. It is really syntactic sugar for the while statement.

Thus:

use strict;
for(Initial_Statement; expression; Increment_Statement) {
    For_Statement;
    For_Statement;
    For_Statement;
}

is equivalent to:

use strict;
Initial_Statement;
while (expression) {
    For_Statement;
    For_Statement;
    For_Statement;
    Increment_Statement;
}


InMotion Web Hosting Customer Support
M-F 8am - 7pm PST
213-239-0050

More information can be found at the InMotion Hosting Main Site