http://www.perlmonks.org?node_id=172354

Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I have many 3 item groupings (i.e. US,USA,USD) and I'd like to maintain a data structure in which given one I can easily write small functions to convert between the other two. I have been playing around with a few data structures, mainly:
my %countryMap = ( US => [USA,USD],...);
and
my $countryMap = { US => {country=>USA, currrency=>USD}, ... };
with these data structures, I can't seem to figure out a way to convert from USA to US and USD to US. can anyone help? thanks.