Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: if (defined %hash) deprecated

by Athanasius (Abbot)
on Oct 15, 2012 at 16:08 UTC ( #999111=note: print w/ replies, xml ) Need Help??


in reply to if (defined %hash) deprecated

Yes. From defined:

Use of defined on aggregates (hashes and arrays) is deprecated. It used to report whether memory for that aggregate had ever been allocated. This behavior may disappear in future versions of Perl. You should instead use a simple test for size:
if (@an_array) { print "has array elements\n" } if (%a_hash) { print "has hash members\n" }

Hope that helps,

Athanasius <°(((><contra mundum


Comment on Re: if (defined %hash) deprecated
Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2015-07-02 11:00 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 (34 votes), past polls