# this regex is based on the published list of international
# country dialling codes:
use constant CCODE_REGEX =>
  qr/2(?:[1-69]\d|[07])    |
     3(?:[578]\d|[0-46-9]) |
     4(?:2\d|\d)           |
     5(?:[09]\d|[1-8])     |
     6(?:[7-9]\d|[0-6])    |
     8(?:[0578]\d|[1246])  |
     9(?:[679]\d|[0-58])   |
     [137]                 /x;


sub strip_ccode ($)
{
    my $num = $_[0];
    my $ccr = CCODE_REGEX;
    $num =~ s/\+?$ccr//;
    return $num;
}