Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Re: Rook question

by sundialsvc4 (Abbot)
on Oct 18, 2012 at 13:21 UTC ( #999732=note: print w/ replies, xml ) Need Help??


in reply to Rook question

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.:
  print STDERR "sum is $sum\n";.

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:
  use strict;
  use warnings;


Comment on Re: Rook question

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://999732]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (17)
As of 2015-07-06 14:56 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (76 votes), past polls