I still continue to struggle with this stuff. I just can't seem to form an array based on a mysql query using perl. I was hoping someone could show me a working example. My first question is should I use an array or a hash to store the data? Here is what I'm trying to do:
I was hoping someone could break this down for me in steps:
ex.
Drew Brees ID=12345 Position=QB Salary=15,000 Points=20
Aaron Rodgers ID = 54321 Postition=QB Salary=14,500 Points=19
Step 1: Get salary data & insert into an array/hash based on player ID as key, and player salary as value.
So the array/hash for @QBsalary would simply be represented as [12345 => 15,000, 54321=>14,500]
Step 2: Get the points data & insert into an array/hash based on player ID as key, and player points as value.
So the array/hash for @QBpoints would simply be represented as [12345 => 20, 54321=>19]
Step 3: How would I iterate through every QB pulling in both their salary & points?
This is very confusing to me. Thanks for any help!
I love it when a program comes together - jdhannibal
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.