Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid

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?

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

How do I use this? | Other CB clients
Other Users?
Others taking refuge in the Monastery: (7)
As of 2016-10-27 11:34 GMT
Find Nodes?
    Voting Booth?
    How many different varieties (color, size, etc) of socks do you have in your sock drawer?

    Results (360 votes). Check out past polls.