foreach $page(keys %yearly_page_hits){ $dbh = DBI->connect("DBI:mysql:$sqlDatabaseName:","$mysqlUsername","$mysqlPassword") or die "Connection Error: $DBI::errstr\n"; $sql = "select count(page) from counter_monthly where page='$page'"; $cursor = $dbh->prepare($sql); $cursor->execute or die "SQL Error: $DBI::errstr\n"; while (@row = $cursor->fetchrow_array) { print "while loop the row for $page is @row

\n"; $new_monthly_page_hits{$page}=@row; print "whileloop".$new_monthly_page_hits{$page}."

"; #push(@yearly_pages,@row); #sort(@yearly_pages); } }