Loop statements

while (expression)
{
statement(s);
Executed repeatedly while expression is true.
}

until (expression)
{
statement(s);
Executed repeatedly while expression is false.
}

do
{
statement(s);
Executed at least once, and repeatedly while expression is true.
}
while (
expression)

do
{
statement(s);
Executed at least once, and repeatedly while expression is false.
}
until (
expression)

for (initialisation; condition; increment)
{
statement(s);
Execute the initialisation statement (e.g. assigning an initial value to the loop counter). While the condition expression is true (e.g. test for the loop counter having reached its final value) execute the statement(s) then the increment statement (e.g. to increment the loop counter).
}

foreach $scalar_var (@list_var)
{
statement(s);
Execute statement(s) once for each item in the list variable. Within the loop, the scalar variable is an alias for the current item: changing the scalar variable's value also changes that list item. The original scalar variable of that name is unaffected.
}