---
name: "Locale::US"
section: "3pm"
platform: "linux"
package: "liblocale-us-perl"
version: "3.04-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/Locale::US"
---

# Locale::US(3pm)

Two letter codes for state identification in the United States and vice versa.

## NAME

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

## 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;
```

## ABSTRACT

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

## 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.

## 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.
```

### AUXILIARY CODE:

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

## 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.

## COPYRIGHT

```
    Copyright (c) 2015 Mike Accardo
    Copyright (c) 2002-2014 Terrence Brannon
```

All rights reserved.  This program is free software; you can redistribute it and/or modify it  under the same terms as Perl itself.
