in reply to
Re^2: list item comparison
in thread list item comparison
When you increment a the value for a key which doesn't exist, the key springs into existence.
Didn't know that. Thanks for the info.
However, I'd like to point out one thing. Back when I was first learning Perl, your one line for loop code would have had me thoroughly confused. Based on the original question asked by the OP, I was left with the impression that the OP was a bit of a beginner. In that case, my foreach loop would probably be somewhat easier to follow along and understand.
Plus, I personally find that my foreach loop more closely matches how I would think through the task, which in turn would mean easier code for me to personally maintain. Just a personal preference.
Anyways, thanks for the tip!