An "it works -- but is it a best practice?" question. In Perl there's a compact way of keeping track of occurrences of, say, strings found within a file: store them in a hash table. For example:
$HashTable{'the string in question'}++;
Perl increments the value for key the string in question as many times as this is done. It ensures unique "hits" at the same time that it keeps track of occurrences. Just hacking around, I found I could do much the same with Powershell:
$HashTable['a']++ or even
$Hashtable.a++ (which kind of surprised me -- or even)
$Hashtable."this is a key"++
Ok, so it works. But is there an approach in Powershell that's considered a better practice?