Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^4: AVG returns COUNT

by ChemBoy (Priest)
on Aug 06, 2005 at 01:38 UTC ( [id://481418]=note: print w/replies, xml ) Need Help??


in reply to Re^3: AVG returns COUNT
in thread AVG returns COUNT

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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (3)
As of 2024-04-19 19:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found