It's not clear what you mean by "two sets of values". Since you have "all the other parts figured out", you should show us (an example of) the actual data structure that stores the "two sets of values". (That is, are you using an array of arrays, or a hash, or something else?) Without knowing that, we'd have to guess how the data is stored in your script, and we're likely to be wrong.
Perhaps you could post a reply with that information.
When you do, PLEASE put <code> above any/every section of text that contains code and/or data, and also put </code> below each of those sections of text. (These can be abbreviated to <c> ... </c> - if you're curious about this, following the link labeled "Writeup Formatting Tips" conveniently located just above the text entry box where you compose a post.