Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- PERL 4.0 Reference Guide - Norton Guide http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]

     each(ASSOC_ARRAY)

     each ASSOC_ARRAY

             Returns a 2 element array consisting of the key  and
             value for the next value of an associative array, so
             that you can iterate over it.  Entries are  returned
             in  an  apparently  random order.  When the array is
             entirely read, a null array is returned (which  when
             assigned produces a FALSE (0) value).  The next call
             to each() after that  will  start  iterating  again.
             The  iterator  can  be reset only by reading all the
             elements from the array.  You must  not  modify  the
             array  while  iterating  over it.  There is a single
             iterator for each associative array, shared  by  all
             each(),  keys()  and  values() function calls in the
             program.  The following prints out your  environment
             like  the  printenv  program,  only  in  a different
             order:

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

See Also: keys values

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson