Trying to get facilty with hash arrays and I am having a nasty time. Please see the snippet below, Btw, I'm working out of A.L. Johnson's "Elements of Programming with Perl" pp.146. Could a you beakdown/explain the code, I'll tell you specifically where I'm stuck after the snippet:
students.dat
------------
Bill Jones : 2 : 35
Anne Smith : 3 : 41
$students {$fields[0]}->[$fields[1]]=$fields[2]
So looks like,
$student is an anonyous hash reference. $fields[0] is the key (ie. key is student name). Taken in total the left side of the arrow is an anonymous array reference. It's the right side of the arrow I don't understand, what's the "=" doing.....Heck, I don't understand. Could a monk gently break it down for me? Help appreciated.
Lee
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.