First, use strict and warnings. Second, since you don't actually declare any of your variables, I can't tell what scope they're in. Are %wordHash and @wordArray supposed to be scoped within the outter while loop (i.e., reset with each line from DATA), or do they store data for the whole input file?

Where does $i get set? It looks like each time you iterate through %wordHash with while ( ($punctuation, $count) = each(%wordHash) ) the array grows.

More importantly, do you really intend to print the contents of %wordHash after every line read from DATA? Unless the hash is scoped within the outter while loop, you probably want to move the while/print block outside of that loop.

You need to give us more information about what you are trying to do in order for us to be of more help. Please see How (Not) To Ask A Question.

Update: Thank you for adding more information to your original post. It appears several of us were on the right track, but after reading the responses it is clear that there was still quite a bit of confusion. Be as specific as you can when you post - it will allow us to help you more efficiently.

In addition, please read Writeup Formatting Tips and note the section on readmore tags. Including 400 lines of output without them makes the thread a bit harder to read.


In reply to Re: punctuation search... using ascii by bobf
in thread punctuation search... using ascii by Yoda_Oz

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • 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:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.