This slightly more ornate example adds up the elements of an array: sum = 0; for( i=0; i## For Loops Perl's C-style "for" loop works like the corresponding "while" loop; that means that this: for ($i = 1; $i < 10; $i++) { ... } is the same as this: $i = 1; while ($i < 10) { ... } continue { $i++; }