Beefy Boxes and Bandwidth Generously Provided by pair Networks Bob
P is for Practical
 
PerlMonks  

Re: "A meditation on Hashes", or "Why i need more aspirin"

by TGI (Vicar)
on Jun 16, 2006 at 22:35 UTC ( #555903=note: print w/ replies, xml ) Need Help??


in reply to "A meditation on Hashes", or "Why i need more aspirin"

It's also interesting to note how undefined and null string values are handled as hash keys.

my %hash; my $a = undef; my $b = ''; $hash{$a} = 'foo'; print "$hash{$a}\n"; print "$hash{$b}\n"; <code> <p>Of course both these throw a warning. <code> C:\temp>hash.pl Use of uninitialized value in hash element at C:\temp\hash.pl line 8. Use of uninitialized value in hash element at C:\temp\hash.pl line 9. foo foo

It turns out I didn't really understand autovivification as well as I thought I did. Thanks for the node.


TGI says moo


Comment on Re: "A meditation on Hashes", or "Why i need more aspirin"
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (10)
As of 2013-05-23 16:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The best material for plates (tableware) is:









    Results (486 votes), past polls