I already posted what I tried, but you keep on asking me the answer for my question.
No, I asked you to answer my questions; you did not answer them. This is how to learn to become a programmer, you ask yourself these questions, and try to answer them.

If you're stuck, you speak the questions out loud and ask the empty room. Does you understand the question? Would another person understand the question? Does the answer make sense?

If you're still stuck, you ask on perlmonks, and when monks ask you questions, you try to answer their questions.

This is how you learn to become a programmer.

I know my code is not good but it works, I just wanted some simple explanation of this.
Well, you asked to acheive similar output but from array not an explanation; did you want to ask for an explanation of something?

In this reply you say UPDATE: Looks like I found the solution. This one is working for me: , but the code is exactly what you had in the beginning, you just changed the variable name, so are you sure its the solution?


In reply to Re^5: Top n Unique count from Array by Anonymous Monk
in thread Top n Unique count from Array by cipher

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.