Perl Home
PERL Functions
© 2011 TutorialsPoint.COM
|
PERL each Function
Syntax
Definition and Usage
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.
Return Value
Example
Following are the usage...This will print out all the environment variables.
while (($key,$value) = each %ENV) {
print "$key=$value\n";
}
|
|

|
|
|