in reply to Hashing up hashes
Instead of
$new_monthly_page_hits{$page}=@row;
I think you want to do
$new_monthly_page_hits{$page} = $row[0];
to actually store the number you got back.
But why do so much work in Perl when you can have the DB do the work?
select page,count(page) from counter_monthly group by page
will return you a list of pairs (page, hitcount). If you only want a very small subset of the whole database as not all pages are of interest to you, then your approach might be faster though.
|
|---|