in reply to Re: Obtaining number of counts per each name in hash
in thread Obtaining number of counts per each name in hash

thats the difficulty i been having. i dont know where i need to place it. in the if statement or before the print statement.
  • Comment on Re^2: Obtaining number of counts per each name in hash

Replies are listed 'Best First'.
Re^3: Obtaining number of counts per each name in hash
by GotToBTru (Prior) on Jul 07, 2015 at 19:32 UTC

    If you don't actually count, you can't place it anywhere. You need to fix that first!

    jeffa has given you the answer here; I would have preferred that you actually work for it and learn thereby. If you have questions about what his code does, let us know.

    Dum Spiro Spero
      I really don't see anything wrong with jeffa's answer.

      People who have not been exposed to hashes (or dictionaries or whatever other names they might have in other languages) often have difficulties understanding the power of these structures for many purposes (counters, removing duplicates, joins, etc.).

      I had the case just this week. A new hire, almost 20 years of developing experience in various languages, but no prior experience with hashes or equivalent structures. Everything else tells me that he is very probably a good developer, but I had to explain him how to use hashes to do these powerful things.

      OK, I found these things by myself, as far as I can remember, when I picked up Perl 11 or 12 years ago, but maybe I just was lucky enough at the time to pick up the right tutorial giving the right clues.

        There is absolutely nothing wrong with his answer. Only a difference of opinion on pedagogy :)

        Dum Spiro Spero
      sorry if it seems that i didnt work through it.

        There's an old adage: give a man a fish, feed him for a day. Teach him to fish, feed him forever.

        You owe me no apology. You can still learn from the example. If you are now more knowledgeable about Perl than you were before, that's a good day at the monastery.

        Dum Spiro Spero