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

Re: Check if hash key value pair is defined

by Anonymous Monk
on Nov 15, 2012 at 14:18 UTC ( #1004021=note: print w/ replies, xml ) Need Help??


in reply to Check if hash key value pair is defined

A data structure as-described must consist of a hash whose values are arrayrefs (or hashrefs). Therefore, first check to see if the key exists(), then use e.g. grep() to look for the desired value.

Be consistent: Arrange the program so that the hash always contains an arrayref, even if it contains only one entry. Perl's "auto-vivification" features make the necessary code for building the structure short-and-sweet.


Comment on Re: Check if hash key value pair is defined

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (6)
As of 2015-07-29 05:57 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 (260 votes), past polls