Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by spazm (Monk)
on May 22, 2011 at 22:07 UTC ( #906207=note: print w/ replies, xml ) Need Help??


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

values will return an array of values from a hash. The array will be in hash-sorted order.
Similarly keys will return an array of keys from a hash. The order of the two arrays will match.

my %hash = ( a=>1, b=>2, c=>3); my @v = values %hash; # e.g. ( 2, 3, 1 ) my @k = keys %hash; # e.g. ('b', 'c', 'a')


Comment on Re: How to print key and value of hash in a list
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2015-08-27 19:41 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The oldest computer book still on my shelves (or on my digital media) is ...













    Results (330 votes), past polls