for my $country_name (keys(%$countries)) { my $country = $countries->{$country_name}; ... }