I have some information I am storing which is unique based on UserIDs. The problem is that the IDs are not sequential (and in fact range from 50,000ish to 120,000ish with approx 2000 unique values.
My obvious first thought was to use these IDs in an array. However, then there is the problem of dealing with all of the IDs which are not assigned a value within the array. (This could be a large issue, as I need to create an n x n array to store a metric comparing each ID to every other ID)
@Social[$id_1][$id_2]
The second thought was to use a Hash with the ID as the key.
Obviously, for the hash I would only be using the number of entries that I have IDs.
%Social{$id_1}{id_2}
Are there downsides for using a hash I am not considering? Or should I be looking at a different data structure?
Thanks.
-dm
Code tags added by GrandFather
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.