# Insert into doubly indexed hash, grouped by country for ISO 3166-2 # codes. One hash is keyed by abbreviation and one by full name. Although # data is duplicated, this provides the fastest lookup and simplest code. $::subcountry_lookup{$country_name}{_code_keyed}{$sub_country_code} = $sub_country_name; $::subcountry_lookup{$country_name}{_full_name_keyed}{$sub_country_name} = $sub_country_code; if ( $category ) { $::subcountry_lookup{$country_name}{$sub_country_code}{_category} = $category; } if ( $regional_division ) { $::subcountry_lookup{$country_name}{$sub_country_code}{_regional_division} = $regional_division; } if ( $FIPS_code ) { # Insert into doubly indexed hash, grouped by country for FIPS 10-4 codes $::subcountry_lookup{$country_name}{_FIPS10_4_code_keyed}{$FIPS_code} = $sub_country_code; $::subcountry_lookup{$country_name}{_ISO3166_2_code_keyed}{$sub_country_code} = $FIPS_code; } #### # Insert into doubly indexed hash, grouped by country for ISO 3166-2 # codes. One hash is keyed by abbreviation and one by full name. Although # data is duplicated, this provides the fastest lookup and simplest code. $::subcountry_lookup{$country_name}{_full_name_keyed}{$sub_country_name} = $sub_country_code || 'UNDEFINED'; # These items all depend on a sub_country_code being set. if ( $sub_country_code ) { $::subcountry_lookup{$country_name}{_code_keyed}{$sub_country_code} = $sub_country_name; if ( $category ) { $::subcountry_lookup{$country_name}{$sub_country_code}{_category} = $category; } if ( $regional_division ) { $::subcountry_lookup{$country_name}{$sub_country_code}{_regional_division} = $regional_division; } if ( $FIPS_code ) { # Insert into doubly indexed hash, grouped by country for FIPS 10-4 codes $::subcountry_lookup{$country_name}{_FIPS10_4_code_keyed}{$FIPS_code} = $sub_country_code; $::subcountry_lookup{$country_name}{_ISO3166_2_code_keyed}{$sub_country_code} = $FIPS_code; } }