Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much

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?

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2015-11-29 17:46 GMT
Find Nodes?
    Voting Booth?

    What would be the most significant thing to happen if a rope (or wire) tied the Earth and the Moon together?

    Results (751 votes), past polls