Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: How to print key and value of hash in a list

by nvivek (Vicar)
on May 23, 2011 at 04:43 UTC ( [id://906236]=note: print w/replies, xml ) Need Help??


in reply to How to print key and value of hash in a list

You can also print the keys and values of a hash in the following way.
my %hash = ( '1' => 'One', '2' => 'Two', '3' => 'Three', + ); print "Key: $_ and Value: $hash{$_}\n" foreach (keys%hash);

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (4)
As of 2025-06-14 21:14 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.