Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic

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.


Comment on Re: perl strange hash value
Download Code

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (1)
As of 2015-10-10 03:40 GMT
Find Nodes?
    Voting Booth?

    Does Humor Belong in Programming?

    Results (254 votes), past polls