The problem is that it's not finding the proper values you initialized to 0 in the 'declare variables' section.
It's complaining about 33 & 34, the last two lines in the following code block (if you exclude the close brace):
foreach my $rec (@records) {
chomp($rec);
($game, $commercial) = split(/,/, $rec);
$game_count{$game} = $game_count{$game} + 1;
$comm_count[$commercial] = $comm_count[$commercial] + 1;
}
Since I see that you initialized 'Great','Boring', and 'None' in the %game_count hash, and also the first 4 values in the @comm_count array, it must be that it's reading values from your record file that are outside that set of indices. Maybe there are uncapitalized 'great' entries, or perhaps a vote for commercial 10?
What's the file look like? That's the next step.
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.