$i++ is the equivalent of
$i=$i+1;
where the = is an operator. It's not just sitting there, like it does in math, saying "these two things are equal"; it tells Perl to make the two things equal. So here it's saying "take the current value of $i and add 1, and make that the new value of $i." Then the for loop continues with the new value of $i. This happens each time the loop runs, until $i reaches 100.
_________
"Abby-somebody. Abby-normal."
Young Frankenstein | [reply] [Watch: Dir/Any] [d/l] |
On second and following iterations, the for loop ignores the initial assignment of value to $i and uses the incremented value (or decremented, if you use a decrement operator instead of an increment operator) instead. The $i=1 assignment happens once, and once only, in for($i=1; $i<=100; $i++).
- apotheon
CopyWrite Chad Perrin | [reply] [Watch: Dir/Any] |