There are many ways to determine if your code is "correct" but you'll need to use at least two approaches if you're going to roll your own tests for a project of this character.

For a general test of your syntax, use strict, use warnings (or, with 5.10 and above, use Modern::Perl and a command line like perl -c progname.pl. Lo and behold, Perl and the pragmas will tell you.

Testing the logic is also fairly easy (at a very rudimentary level): Run your script (using a small subset of each of your data files); look at the results to see if they match what you expect. Rinse, repeat. Then modify one or more of the data files subset so that it no longer matches your model (format). Does the script still work? If so, you're done; if not, you have some error-catching-code still to write.

Of course, with anything at all complex, you'll be better served by learning about testing, a topic discussed here rather frequently.


In reply to Re: averages from multiple files by ww
in thread averages from multiple files by Taylorswift13

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.