Hmm, this seems a bit dodgy, but you have a regular expression that basically looking for anything, followed by a colon followed by any 4 characters followed by "/" followed by two characters followed by "/" followed by 2 characters, followed by a colon, followed by anything. If there is a match then the four characters will be assigned to $1.
As $1 is the hash index, then whenever 2002 is encountered then the value for key 2002 is incremented
However, I should point out that the regular expression doesn't distinguish between alpha characters and digits, that the date could be in the wrong field, and probably many more issues that other monks may point out.
P.S. Is this homework?
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.