1Locale::US(3) User Contributed Perl Documentation Locale::US(3)
2
3
4
6 Locale::US - Two letter codes for state identification in the United
7 States and vice versa.
8
10 use Locale::US;
11
12 my $u = Locale::US->new;
13
14 my $state = $u->{code2state}{$code};
15 my $code = $u->{state2code}{$state};
16
17 my @state = $u->all_state_names;
18 my @code = $u->all_state_codes;
19
21 Map from US two-letter codes to states and vice versa.
22
24 MAPPING
25 $self->{code2state}
26
27 This is a hashref which has two-letter state names as the key and the
28 long name as the value.
29
30 $self->{state2code}
31
32 This is a hashref which has the long nameas the key and the two-letter
33 state name as the value.
34
35 DUMPING
36 $self->all_state_names
37
38 Returns an array (not arrayref) of all state names in alphabetical form
39
40 $self->all_state_codes
41
42 Returns an array (not arrayref) of all state codes in alphabetical
43 form.
44
46 • The state name is returned in "uc()" format.
47
48 • neither hash is strict, though they should be.
49
51 Locale::Country
52 Locale::Country
53
54 Abbreviations
55 <http://www.usps.gov/ncsc/lookups/usps_abbreviations.htm>
56
57 Online file with the USPS two-letter codes for the United States and its possessions.
58
59 AUXILIARY CODE:
60 lynx -dump http://www.usps.gov/ncsc/lookups/usps_abbreviations.htm > kruft.txt
61 kruft2codes.pl
62
64 Currently maintained by Mike Accardo, <accardo@cpan.org>
65
66 Original author T. M. Brannon
67
68 PATCHES
69 Thanks to stevet AT ibrinc for a patch about second call to new
70 failing.
71
73 Copyright (c) 2015 Mike Accardo
74 Copyright (c) 2002-2014 Terrence Brannon
75
76 All rights reserved. This program is free software; you can
77 redistribute it and/or modify it under the same terms as Perl itself.
78
79
80
81perl v5.32.1 2021-01-27 Locale::US(3)