Tutorials Point


  Perl Home

  PERL Functions

© 2011 TutorialsPoint.COM


  Home     References     About TP     Advertising  

PERL each Function



Syntax

each HASH


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

  • See definition

Example

Following are the usage...This will print out all the environment variables.

    while (($key,$value) = each %ENV) {
	print "$key=$value\n";
    }


Printer Friendly



  

Advertisement

Online Image Processing

Indian Baby Names