Michael Schout


Number::Phone::CountryCode - Country phone dialing prefixes


 use Number::Phone::CountryCode;

 # retrieve object of United Kingdom codes.
 my $pc = Number::Phone::CountryCode->new('GB');

 print $pc->country;       # ISO 3166 code, e.g: GB
 print $pc->country_code;  # country prefix
 print $pc->idd_prefix;    # IDD prefix
 print $pc->ndd_prefix;    # NDD prefix

 # get list of supported ISO 3166 codes
 my @countries = Number::Phone::CountryCode->countries;

See below for description of the country/IDD/NDD prefixes.


This module provides an interface to lookup country specific dialing prefixes. These prefixes are useful when working with phone numbers from different countries. The follwing codes are available for each country:

Country Code

This is the national prefix to be used with dialing to a country from another country.

National Direct Dialing Prefix (NDD)

This is the prefix used to make a call within a country from one city to another. This prefix may not be necessary when calling another city in the same vicinity. This is followed by the city or area code for the place you are calling. For example, in the US, the NDD prefix is "1", so you must dial 1 before the area code to place a long distance call within the country.

International Direct Dialing Prefix (IDD)

This is the prefix needed to make a call from a country to another country. This is followed by the country code for the country you are calling. For example, when calling another country from the US, you must dial 011.



Constructs a new Number::Phone::CountryCode object. $country is the two digit ISO 3166 country code for the country you wish to look up. Returns undef if the country code did not match one of the supported countries.


The following methods are available


the ISO 3166 country code for this country


The national prefix for this country


The NDD prefix for this country. Note that this might be undef if no prefix is necessary.


The IDD prefix for this country. Note that this might be undef if no prefix is necessary.


The following class methods are available (may be called without constructing an object).


Returns a list of all ISO 3166 country codes supported by this module.


Returns true if the given country is supported, false otherwise. $country is a 2 character ISO 3166 country code.


You can contribute to or fork this project via github:


 git clone git://github.com/mschout/number-phone-countrycode.git


Please report any bugs or feature requests to bug-number-phone-countrycode@rt.cpan.org, or through the web interface at http://rt.cpan.org

I welcome feedback, and additions/corrections to the country code data contained within this module.


Michael Schout, <mschout@gkg.net<gt>


Copyright (C) 2009 by Michael Schout

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.8.0 or, at your option, any later version of Perl 5 you may have available.