NAME
Geography::USStates - USA State Data
SYNOPSIS
use Geography::USStates;
$state = getState('mn'); # -- get the statename 'Minnesota'
$state = getState('wisconsin'); # -- get the abbreviation 'wi'
@states = getStateNames(); # -- return all state names
@states = getStateAbbrevs(); # -- return all abbrevations
%s = getStates(); # -- return hash $states{'MN'} = 'Minnesota'
%s = getStates(case=>'upper'); # -- return hash $states{'MN'} = 'MINNESOTA'
%s = getStates(case=>'lower'); # -- return hash $states{'MN'} = 'minnesota'
%s = getStates(hashkey=>'name');# -- return hash $states{'Minnesota'} = 'MN'
DESCRIPTION
This module allows you to get information on US State names, their abbreviations, and couple the two together (in hashes)
FUNCTIONS
o getState($statename || $stateabbrev)
Given an abbreviation a statename is returned.
Given a name an abbreviatin is returned
e.g. print getState('MN');
would print 'Minnesota'
print getState('wisconsin');
would print 'WI'
o getStateNames()
Return all of the states in an array
e.g. map { print "$_\n" } getStateNames();
would print "Alabama\nAlaska\n...";
o getStateAbbrevs()
Return all of the abbrevs in an array
e.g. map { print "$_\n" } getStateAbbrevs();
would print "AL\nAK\n...";
o getStates(%hash | $hashref) [keys: case => upper||lower, hashkey=>name]
A hash is returned with both abbrev and statename. By default it returns
the state abbrev as the key and the state name as the value
e.g. $hash{MN} = 'Minnesota';
You can also pass params in a hash or hashref. To force the state names
to be lower case, or upper case you do:
getStates(case => 'upper'); # -- for upper case... lower for lower case
If you want to return a hash where the name is the key you do:
my %s = getStates(hashkey => 'name');
and then
$s{'Minnesota'} = 'MN';
AUTHOR
Dion Almaer (dion@member.com)