You are correct—you're missing the use strict that you commented out from the beginning of the file. :-)

Had you left it in, and left uncommented both print lines, you would have gotten (and probably did get) these errors:

Global symbol "$avg" requires explicit package name at runsql.pl line +20. Global symbol "@r" requires explicit package name at runsql.pl line 21 +.

What those messages are telling you is that you have a variable you didn't declare using our, use vars or my. If you think they're wrong, you probably have done one of two things: tried to use an array or hash in place of a reference to one, or made a typo. In this case, conveniently enough, you have one of each. :-) If you comment out print ("@r \n") (by which you presumably meant print "@{$r} \n") and change my $agv to my $avg, you should see those errors go away (after you put strict back in so they show up, of course).

Then you just have the SQL error, which is annoying—I would class it as a bug in the DBD module, but in any case, it should go away if you change count(1) to count(*), or possibly count(ERWWCOMMUNITIES_Memory_Pages_sec). Or, since you don't really need it anyway, just take it out entirely.

And if you don't know what I mean by a reference to an array or hash, take a quick look at perlref and the always-popular References quick reference, and you shall be enlightened. :-)

Good luck!



If God had meant us to fly, he would *never* have given us the railroads.
    --Michael Flanders


In reply to Re^4: AVG returns COUNT by ChemBoy
in thread AVG returns COUNT by DrAxeman

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.