thats the difficulty i been having. i dont know where i need to place it. in the if statement or before the print statement. | [reply] |
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.
| [reply] |
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.
| [reply] |
sorry if it seems that i didnt work through it.
| [reply] |