Perl Programming/Keywords/each

The each keyword
each returns a two-element list consisting of the key and value for the next element of a hash, if called on a hash in list context. In Perl 5.12 and later only, it returns the index and value for the next element of an array. For older Perl versions, this is considered as a syntax error. When called in scalar context, it returns only the key (not the value) in a hash, or the index in an array.

Examples
The code