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").
In reply to Re: for loop
by moritz
in thread for loop
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |