With the fairly new Perl 5.12, each() now accepts an array, as opposed to only a hash.
each returns a 2 element list, containing the key and value for the next element in a hash, and now, in an array as well. In addition to the usual:
we can also do this:
The index is the key, and the element itself is the value. This means we can do things like:
instead of manually keeping count: