in reply to for loop
That's because the syntax of the for loop is wrong; you probably want ; instead of , in there.
With the commas it's just a 3-element list (0, 1, 0) over which the for iterates. But you can write that even easier:
for (1..$n) { # body of the loop goes here }
See perlsyn for more information about the syntax of for-loops (scroll down to subsection "Foreach Loops").
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: for loop
by Anonymous Monk on Nov 04, 2011 at 10:00 UTC |