Perl each Function


Advertisements


Description

This function when called in list context, returns a 2-element list consisting of the key and value for the next element of a hash, so that you can iterate over it. When called in scalar context, returns only the key for the next element in the hash.

Syntax

Following is the simple syntax for this function −

each HASH

Return Value

This function when called in list context, returns a 2-element list consisting of the key and value for the next element of a hash, so that you can iterate over it. It returns only the key for the next element in the hash when called in scalar context.


perl_function_references.htm

Advertisements