<P>The <STRONG>Tie::CPHash</STRONG> provides a hash table that is case preserving but
case insensitive. This means that</P>
<PRE>
$cphash{KEY} $cphash{key}
$cphash{Key} $cphash{keY}</PRE>
<P>all refer to the same entry. Also, the hash remembers which form of
the key was last used to store the entry. The <A HREF="../../../lib/Pod/perlfunc.html#item_keys"><CODE>keys</CODE></A> and <A HREF="../../../lib/Pod/perlfunc.html#item_each"><CODE>each</CODE></A>
functions will return the key that was used to set the value.</P>
<P>An example should make this clear:</P>
<PRE>
tie %h, 'Tie::CPHash';
$h{Hello} = 'World';
print $h{HELLO}; # Prints 'World'
print keys(%h); # Prints 'Hello'
$h{HELLO} = 'WORLD';
print $h{hello}; # Prints 'WORLD'
print keys(%h); # Prints 'HELLO'</PRE>
<P>The additional <CODE>key</CODE> method lets you fetch the case of a specific key:</P>
<PRE>
# When run after the previous example, this prints 'HELLO':
print tied(%h)->key('Hello');</PRE>
<P>(The <A HREF="../../../lib/Pod/perlfunc.html#item_tied"><CODE>tied</CODE></A> function returns the object that <CODE>%h</CODE> is tied to.)</P>
<P>If you need a case insensitive hash, but don't need to preserve case,
just use <CODE>$hash{lc $key}</CODE> instead of <CODE>$hash{$key}</CODE>. This has a lot
less overhead than <STRONG>Tie::CPHash</STRONG>.</P>
<P>
<HR>
<H1><A NAME="author">AUTHOR</A></H1>
<P>Christopher J. Madsen <<EM><A HREF="mailto:chris_madsen@geocities.com">chris_madsen@geocities.com</A></EM>></P>