in reply to Learning to use "each"
Hi.
The reasons why your code snippet doesn't work have been explained (I hope to your satisfaction?).
However, if you're interested in visualising only the keys of your hash, each is not really your friend. Do this instead:
for my $key ( keys %hash ) { print $key, "\n"; }
Or, even more succinctly:
print "$_\n" for keys %hash;
|
|---|