In the line print "while loop the row for $page is @row\n";, you should escape @row (ie. \@row), since it will otherwise try to interpolate the values of @row into the string.
In the next line $new_monthly_page_hits{$page}=@row; you are assigning to the array @row in scalar context, which means you're taking the number of items in @row, NOT the actual values from the array. Since the value you actually want to assign to is probably the first element in the array, try assigning to $row[0] instead (or use Data::Dumper to print out the contents of @row, so you can see what's going on).