Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
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 wandering the Monastery: (19)
As of 2015-07-02 16:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (44 votes), past polls