in reply to Half of hash references are missing
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 }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Half of hash references are missing
by jerzy (Novice) on May 12, 2011 at 07:52 UTC |