<?xml version="1.0" encoding="windows-1252"?>
<node id="1004021" title="Re: Check if hash key value pair is defined" created="2012-11-15 09:18:03" updated="2012-11-15 09:18:03">
<type id="11">
note</type>
<author id="961">
Anonymous Monk</author>
<data>
<field name="doctext">
A data structure as-described &lt;i&gt;must&lt;/i&gt; consist of a hash whose values are arrayrefs (or hashrefs).  Therefore, first check to see if the key &lt;tt&gt;exists()&lt;/tt&gt;, then use e.g. &lt;tt&gt;grep()&lt;/tt&gt; to look for the desired value. &lt;br/&gt;&lt;br/&gt;Be consistent: Arrange the program so that the hash &lt;i&gt;always&lt;/i&gt; 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.</field>
<field name="root_node">
1003939</field>
<field name="parent_node">
1003939</field>
<field name="reputation">
3</field>
</data>
</node>
