Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

comment on

( [id://3333] : superdoc . print w/replies, xml ) Need Help??
use strict;
And the problem will jump right off the page.
I'm sorry, that's just wrong. A use strict would cause 60 completely unrelated and spurious errors to "jump right off the page" at our poor unsuspecting programmer. It wouldn't be helpful at all and probably counter-productive.

He'd probably do what every new programmer does when they see this: declare everything with my until the errors go away. Which means he'd probably declare the wrong variable names with my too in the massive effort to track down and declare all of his variables. So in effect he'd be using strict for no good reason, waste his time, cluttered his code, and still not found his error. Looking at this script he probably doesn't need the benefits of lexicals anyway.

Turn on warnings instead. A -w in the #! line or a use warnings would make the problem a lot more obvious. In fact, perl tells you *exactly* what the problem is. And finds another one for you as well.


PS to the original poster: the codeopen INPUT, "a:scores.txt" || die "Cannot locate input file: $!"; has the wrong precedence and doesn't do what you think it does. Try an "or" instead of "||".

In reply to Re: Re: I/O problems...what am I missing? by clintp
in thread I/O problems...what am I missing? by psychoto

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.