Search notes:

Perl function: each

use warnings;
use strict;

my %h = (
  'one'   => 'foo',
  'two'   => 'bar',
  'three' => 'baz'
);


while ( my ($k, $v) = each %h) {
  printf ("%-5s -> %s\n", $k, $v);
}

print "-------------------\n";

my @a = qw(abc de fgh ij);

while (my ($i, $e) = each(@a)) {
  print "$i: $e\n";
}
Github repository about-perl, path: /functions/each.pl

See also

Perl functions

Index