Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

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

by kejohm (Hermit)
on May 22, 2011 at 22:34 UTC ( [id://906209]=note: print w/replies, xml ) Need Help??


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

You could also use the each function, which returns the next key and value pair of the hash, eg.

my %hash = ( 'apple' => 'red', 'banana' => 'yellow', ); while( my( $key, $value ) = each %hash ){ print "$key: $value\n"; }

See each for more info.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (3)
As of 2025-06-19 00:47 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.