Kyle wrote "The real problem with each is that every hash has only one iterator, and if you drop out of a loop that's walking the hash, the next loop that tries to walk that hash will start where the first left off."
Can you give an example where the above mentioned happens or point me to an example. Thanks very much
local $\ = "\n";
my %h = map { $_ => 1 } qw( a b c d );
for my $pass (1..3) {
print "Pass $pass:";
while (my ($k,$v) = each %h) {
print $k;
last if $pass == 1;
}
}
local $\ = "\n";
my %h = map { $_ => 1 } qw( a b c d );
for my $pass (1..3) {
print "Pass $pass:";
keys %h; # Reset iterator
while (my ($k,$v) = each %h) {
print $k;
last if $pass == 1;
}
}