|
|
| The stupid question is the question not asked | |
| PerlMonks |
Re: Rook questionby sundialsvc4 (Monsignor) |
| on Oct 18, 2012 at 13:21 UTC ( #999732=note: print w/ replies, xml ) | Need Help?? |
|
One of the trickiest notions in Perl is the issue of contexts. When you wrote $sum += @_, you used an @array value in a $scalar context. That changes what it does.
For debugging such things, I would insert a statement within the loop that prints useful information to the STDERR file, e.g.: All interactive programs have two output streams, STDOUT and STDERR, the latter intended for error or diagnostic outputs.
Also, get used to now putting these two statements at the start of every program:
In Section
Seekers of Perl Wisdom
|
|
||||||||||||||||||||