Beefy Boxes and Bandwidth Generously Provided by pair Networks
laziness, impatience, and hubris
 
PerlMonks  

Re: Learning to use "each"

by Not_a_Number (Parson)
on Apr 28, 2011 at 19:36 UTC ( #901858=note: print w/ replies, xml ) Need Help??


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;


Comment on Re: Learning to use "each"
Select or Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://901858]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (7)
As of 2014-12-28 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    Is guessing a good strategy for surviving in the IT business?





    Results (178 votes), past polls