# Assuming you like the idea of scoping two variables # lexically within the while block as noted in previous # comments while ( my ( $page_title, $hit_count ) = @{ $cursor->fetchrow_arrayref() } ) { $page_hits{$page_title} = $hit_count; }