Each hash has only one iterator used by all each on that hash. You must have something like this:
my %h = map { $_ => 1 } qw( a b c d ); while (my $k = each(%h)) { last; } while (my $k = each(%h)) { print("$k\n"); # a b d }
Data::Dumper causes the iterator to be reset. keys(%h) will do that too.
my %h = map { $_ => 1 } qw( a b c d ); while (my $k = each(%h)) { last; } keys(%h); while (my $k = each(%h)) { print("$k\n"); # c a b d }
In reply to Re: Half of hash references are missing
by ikegami
in thread Half of hash references are missing
by jerzy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |