Perl has a few “tricks up its sleeve” to make some coding tasks a little easier. For example, if you simply write, $somehash{'foo'}++, then the key associated with 'foo' will be an integer that gets incremented ... even if no such key exists previously! Perl simply “does what you mean.” It automagically creates a key if necessary, then increments it. So, if you want to use a hash to count the number of occurrences of words in a string (a very common objective...) Perl, by design, makes that trivial.