in reply to number of keys and values in a hash
You are calling "keys" inside the while loop where you are doing "each". Calling "keys" resets the "each" loop. Which explains the infinite loop.
As pointed out, there's no need to iterate over the hash using each. Considering you are calling keys - I've no idea why you are using each.
Furthermore, since you build the hash as a one key, one value pair, why the need to find out the number of keys? The answer to that is already known, isn't it?
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^2: number of keys and values in a hash
by veerubiji (Sexton) on Oct 12, 2011 at 07:10 UTC | |
by JavaFan (Canon) on Oct 12, 2011 at 12:01 UTC |
In Section
Seekers of Perl Wisdom