---
name: "NCC::CountryCode"
section: "3pm"
platform: "linux"
package: "asused"
version: "3.72-14"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/NCC::CountryCode"
---

# NCC::CountryCode(3pm)

Perl extension for blah blah blah

## NAME

NCC::CountryCode - Perl extension for blah blah blah

## SYNOPSIS

```
  use NCC::CountryCode;

  my $cc = new NCC::CountryCode();

  my $cc_hash = $cc->getCCs();

  print ($cc->isCC('NL')) ? "exists" : "non-existing";

  $cc->CC2Country('fr');

  $cc->Country2CC('russia');
```

## DESCRIPTION

This module provides class and several methods to simplify mapping between country names and country codes, as they assigned in the ISO3166.

The **CC2Country()** method maps country code to the corresponding country name or empty string, if it doesn\\'t exist.

The **Country2CC()** tries to map passed country name into country code. As the  spelling of the name may vary, this function tries to find all possible matches for passed name. In array context method returns hash of country codes and names, in scalar - a string, containing all possible country codes and corresponding country names.

The **isCC()** method verifies, that passed country code is a legal one and returns it in upper case. Otherwise it returns empty string.

The **getCCs()** method returns the reference to the internal hash, that contains all the country codes with corresponding them country names.

## BUGS

In addition to the country codes defined by ISO3166 standard this module also introduce 'UK' as a synonim for 'GB' and 'EU' as additional 'virtual' name for the Europe itself.

## AUTHOR

Timur Bakeyev, timur@ripe.net

## SEE ALSO

[**perl**(1)](/perl/1.md).
