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] |
| [reply] |
sorry if it seems that i didnt work through it.
| [reply] |
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.
| [reply] |