Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: data structure problem

by jwest (Friar)
on Jun 06, 2002 at 21:03 UTC ( #172365=note: print w/ replies, xml ) Need Help??


in reply to data structure problem

Presupposing that 'country' and 'currency' will always be unique keys (and renaming your old %countryMap to %codeMap because the label made more sense to me in this case), this would work...

my %codeMap = ( US => { country => 'USA', currency => 'USD'} ); my %currencyMap = map { $codeMap{$_}{currency} => $_ } keys(%codeMap); my %countryMap = map { $codeMap{$_}{country} => $_ } keys(%codeMap);

But, you probably want to use a database for this.
Hope this helps!

--jwest

-><- -><- -><- -><- -><-
All things are Perfect
    To every last Flaw
    And bound in accord
         With Eris's Law
 - HBT; The Book of Advice, 1:7


Comment on Re: data structure problem
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://172365]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (10)
As of 2014-07-14 07:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (255 votes), past polls