In my opinion, your best bet is to use Perl in conjunction with a relational database, via the
DBI interface. Perl data structures don't represent this data ideally; there are a lot of relations here which can be expressed more clearly using a RDBMS and SQL, than in Perl using nested hashes/arrays. If you don't have a database system handy, you can grab and install
DBD::SQLite, which is a small, zero-configuration SQL database system.
If you really want to do this in pure Perl, here are some tips:
Rather than having space- or pipe-separated string lists in your data structures, use array refs instead, as in:
$country_data->{WORLDS}{Region_code} = [ split /\|/, 'ARG|AU|BELG|BRAZ
+|CAN|...' ];
Write a lot of intermediate functions like get_exchangetags_from_countrycode() and is_country_in_region() and write your higher-level routine in terms of these, rather than making one monolithic routine which tweaks all your data structures directly. This is called 'abstraction', and it not only frees you to think at a higher level without worrying about lower-level details, it is a godsend should you ever have to change the layout of your data structures.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.