http://www.perlmonks.org?node_id=123180


in reply to sprintf and for loop weirds???

When checked with perl -cw, your first snippet yields:

syntax error at foo line 6, near "];"

The sprintf call is missing a closing parenthesis.