Look again at lines 4-5 and 8-9. In one case, you have a spelling error...so the only thing saving you is the existence of the second pair, which would be redundant were the first caught and corrected.
Perhaps you've posted code that is not be what you've actually written. Try to post with cut'n'paste, to avoid such problems.
And whether or not what's shown is your actual code, use strict;, use warnings, as they will alert you to problems with your variables, such as:
Global symbol "$file" requires explicit package name at F:\_Perl_\pl_test\921134.pl line 7. (your line 4)
Fixing those and rerunning would have allowed strict and warnings to point out additional syntax errors (not including the grammatical error in your print statement at your line 20). When you've dealt with those, you'll be free to concentrate on the logic.
You've already been alerted (by other Monks) to some of your logical problems; you've added to them and need to further your understanding of hashes.
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.