Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

Re: Hash element that won't print. Perl Bug???

by kjherron (Pilgrim)
on Oct 10, 2001 at 09:14 UTC ( [id://117932]=note: print w/replies, xml ) Need Help??


in reply to Hash element that won't print. Perl Bug???

The 00 in the term $hash{00} is initially evaluated as a number, rather than a string, because it's not in quotes. Perl then converts the number back into a string to store into the hash. As a result, the assignment
$hash{00} = "data";
actually stores into $hash{"0"}, not $hash{"00"}.

Later, when you try to access $hash{0 . "0"}, you do access $hash{"00"}, which of course is not the same as $hash{"0"}.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others avoiding work at the Monastery: (4)
As of 2024-04-25 15:57 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found