Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
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 avoiding work at the Monastery: (13)
As of 2014-12-18 19:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (61 votes), past polls