<?xml version="1.0" encoding="windows-1252"?>
<node id="1003943" title="Re: Check if hash key value pair is defined" created="2012-11-15 02:10:54" updated="2012-11-15 02:10:54">
<type id="11">
note</type>
<author id="281137">
davido</author>
<data>
<field name="doctext">
&lt;p&gt;Keys in hashes are unique.  The only way for a key to have multiple values is if the "value" is a reference to some container (an anonymous hash, anonymous array, or some object).  Let's say your hash holds references to arrays.  You might do this:&lt;/p&gt;
&lt;c&gt;
my %hash = ( unwanted =&gt; [1], wanted =&gt; [2, 3, 4] );
my $target_key = 'wanted';
if(    exists $hash{ $target_key } 
    &amp;&amp; ref $hash{ $target_key } eq 'ARRAY' 
    &amp;&amp; @{ $hash{ $target_key } } &gt; 1 
) {
    print "The element associated with $target_key holds a reference to an array of @{$hash{$target_key}} values.\n";
}
&lt;/c&gt;

&lt;div class="pmsig"&gt;&lt;div class="pmsig-281137"&gt;
&lt;br /&gt;&lt;p&gt;Dave&lt;/p&gt;
&lt;/div&gt;&lt;/div&gt;</field>
<field name="root_node">
1003939</field>
<field name="parent_node">
1003939</field>
</data>
</node>
