Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: hash assignment wierdness

by Errto (Vicar)
on Apr 20, 2007 at 17:59 UTC ( [id://611212]=note: print w/replies, xml ) Need Help??


in reply to hash assignment wierdness

The way to assign no elements to a hash is
%h = ();
After this statement defined %h returns false. Whereas
%h = undef;
is assigning a single key to the hash (whose value happens to be undef, and thus coerced into the empty string '') with no corresponding value, hence the warning. But after this assignment the hash is no longer empty, so defined %h returns true.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others imbibing at the Monastery: (2)
As of 2024-04-25 20:37 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found