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

Re: perl strange hash value

by davido (Archbishop)
on Sep 08, 2012 at 17:09 UTC ( #992510=note: print w/ replies, xml ) Need Help??


in reply to perl strange hash value

When you look at a hash in scalar context you get a rather useless fraction that describes how the buckets are allocated and being used. When you look at a hash in list context, you get a raw dump of key, value, key, value, which is usually what you want.

my %hash = qw( a 1 b 2 c 3 d 4 ); print scalar %hash, "\n"; # prints "3/8" print %hash, "\n"; # prints c3a1b2d4 but in # an unpredictable order of key, value, key, value.

Dave


Comment on Re: perl strange hash value
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (4)
As of 2014-04-19 18:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (483 votes), past polls