<?xml version="1.0" encoding="windows-1252"?>
<node id="625" title="How can I know how many entries are in a hash?" created="1999-10-07 20:20:52" updated="2005-08-15 08:57:15">
<type id="834">
perlfaq nodetype</type>
<author id="519">
faq_monk</author>
<data>
<field name="doctext">


&lt;P&gt;
If you mean how many keys, then all you have to do is take the scalar sense of the 
&lt;CODE&gt;keys()&lt;/CODE&gt; function:

&lt;P&gt;
&lt;PRE&gt;    $num_keys = scalar keys %hash;
&lt;/PRE&gt;
&lt;P&gt;
In void context it just resets the iterator, which is faster for tied
hashes.

&lt;P&gt;
</field>
</data>
</node>
