2 <!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns=
"http://www.w3.org/1999/xhtml">
5 <title>Tie::RefHash - use references as hash keys
</title>
6 <meta http-equiv=
"content-type" content=
"text/html; charset=utf-8" />
7 <link rev=
"made" href=
"mailto:" />
10 <body style=
"background-color: white">
11 <table border=
"0" width=
"100%" cellspacing=
"0" cellpadding=
"3">
12 <tr><td class=
"block" style=
"background-color: #cccccc" valign=
"middle">
13 <big><strong><span class=
"block"> Tie::RefHash - use references as hash keys
</span></strong></big>
17 <p><a name=
"__index__"></a></p>
22 <li><a href=
"#name">NAME
</a></li>
23 <li><a href=
"#synopsis">SYNOPSIS
</a></li>
24 <li><a href=
"#description">DESCRIPTION
</a></li>
25 <li><a href=
"#example">EXAMPLE
</a></li>
26 <li><a href=
"#author">AUTHOR
</a></li>
27 <li><a href=
"#version">VERSION
</a></li>
28 <li><a href=
"#see_also">SEE ALSO
</a></li>
35 <h1><a name=
"name">NAME
</a></h1>
36 <p>Tie::RefHash - use references as hash keys
</p>
40 <h1><a name=
"synopsis">SYNOPSIS
</a></h1>
44 tie HASHVARIABLE, 'Tie::RefHash', LIST;
45 tie HASHVARIABLE, 'Tie::RefHash::Nestable', LIST;
</pre>
47 untie HASHVARIABLE;
</pre>
51 <h1><a name=
"description">DESCRIPTION
</a></h1>
52 <p>This module provides the ability to use references as hash keys if you
53 first
<code>tie
</code> the hash variable to this module. Normally, only the
54 keys of the tied hash itself are preserved as references; to use
55 references as keys in hashes-of-hashes, use Tie::RefHash::Nestable,
56 included as part of Tie::RefHash.
</p>
57 <p>It is implemented using the standard perl TIEHASH interface. Please
58 see the
<code>tie
</code> entry in
<code>perlfunc(
1)
</code> and
<code>perltie(
1)
</code> for more information.
</p>
59 <p>The Nestable version works by looking for hash references being stored
60 and converting them to tied hashes so that they too can have
61 references as keys. This will happen without warning whenever you
62 store a reference to one of your own hashes in the tied hash.
</p>
66 <h1><a name=
"example">EXAMPLE
</a></h1>
69 tie %h, 'Tie::RefHash';
73 $d = \
"gunk
";
75 %h = ($a =
> 1, $b =
> 2, $c =
> 3, $d =
> 4, $e =
> 5);
79 print ref($_),
"\n
";
82 tie %h, 'Tie::RefHash::Nestable';
84 for (keys %h, keys %{$h{$a}}) {
85 print ref($_),
"\n
";
90 <h1><a name=
"author">AUTHOR
</a></h1>
91 <p>Gurusamy Sarathy
<a href=
"mailto:gsar@activestate.com">gsar@activestate.com
</a></p>
92 <p>'Nestable' by Ed Avis
<a href=
"mailto:ed@membled.com">ed@membled.com
</a></p>
96 <h1><a name=
"version">VERSION
</a></h1>
101 <h1><a name=
"see_also">SEE ALSO
</a></h1>
102 <p>perl(
1), perlfunc(
1),
<code>perltie(
1)
</code></p>
103 <table border=
"0" width=
"100%" cellspacing=
"0" cellpadding=
"3">
104 <tr><td class=
"block" style=
"background-color: #cccccc" valign=
"middle">
105 <big><strong><span class=
"block"> Tie::RefHash - use references as hash keys
</span></strong></big>