logo
Free, unlimited AI code reviews that run on commit
git-lrc git-lrc GitHub Install Now We'd appreciate a star git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt git-lrc - Free, unlimited AI code reviews that run on commit | Product Hunt

Locale::US - Two letter codes for state identification in the United States and vice versa.

Abstract

       Map from US two-letter codes to states and vice versa.

Author

       Currently maintained by Mike Accardo, <accardo@cpan.org>

       Original author T. M. Brannon

   PATCHES
       Thanks to stevet AT ibrinc for a patch about second call to new failing.

Description

MAPPING$self->{code2state}

       This is a hashref which has two-letter state names as the key and the long name as the value.

       $self->{state2code}

       This is a hashref which has the long nameas the key and the two-letter state name as the value.

   DUMPING$self->all_state_names

       Returns an array (not arrayref) of all state names in alphabetical form

       $self->all_state_codes

       Returns an array (not arrayref) of all state codes in alphabetical form.

Known Bugs And Limitations

       •   The state name is returned in "uc()" format.

       •   neither hash is strict, though they should be.

Name

       Locale::US - Two letter codes for state identification in the United States and vice versa.

See Also

Locale::Country
       Locale::Country

   Abbreviations
       <http://www.usps.gov/ncsc/lookups/usps_abbreviations.htm>

           Online file with the USPS two-letter codes for the United States and its possessions.

   AUXILIARYCODE:
           lynx -dump http://www.usps.gov/ncsc/lookups/usps_abbreviations.htm > kruft.txt
           kruft2codes.pl

Synopsis

         use Locale::US;

         my $u = Locale::US->new;

         my $state = $u->{code2state}{$code};
         my $code  = $u->{state2code}{$state};

         my @state = $u->all_state_names;
         my @code  = $u->all_state_codes;

See Also