Install Perl 5.8.8
[msysgit.git] / mingw / html / lib / Tie / RefHash.html
blobc9d499174fc74737f39223feb47f82834024c520
1 <?xml version="1.0" ?>
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">
4 <head>
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:" />
8 </head>
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">&nbsp;Tie::RefHash - use references as hash keys</span></strong></big>
14 </td></tr>
15 </table>
17 <p><a name="__index__"></a></p>
18 <!-- INDEX BEGIN -->
20 <ul>
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>
29 </ul>
30 <!-- INDEX END -->
32 <hr />
33 <p>
34 </p>
35 <h1><a name="name">NAME</a></h1>
36 <p>Tie::RefHash - use references as hash keys</p>
37 <p>
38 </p>
39 <hr />
40 <h1><a name="synopsis">SYNOPSIS</a></h1>
41 <pre>
42 require 5.004;
43 use Tie::RefHash;
44 tie HASHVARIABLE, 'Tie::RefHash', LIST;
45 tie HASHVARIABLE, 'Tie::RefHash::Nestable', LIST;</pre>
46 <pre>
47 untie HASHVARIABLE;</pre>
48 <p>
49 </p>
50 <hr />
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>
63 <p>
64 </p>
65 <hr />
66 <h1><a name="example">EXAMPLE</a></h1>
67 <pre>
68 use Tie::RefHash;
69 tie %h, 'Tie::RefHash';
70 $a = [];
71 $b = {};
72 $c = \*main;
73 $d = \&quot;gunk&quot;;
74 $e = sub { 'foo' };
75 %h = ($a =&gt; 1, $b =&gt; 2, $c =&gt; 3, $d =&gt; 4, $e =&gt; 5);
76 $a-&gt;[0] = 'foo';
77 $b-&gt;{foo} = 'bar';
78 for (keys %h) {
79 print ref($_), &quot;\n&quot;;
80 }</pre>
81 <pre>
82 tie %h, 'Tie::RefHash::Nestable';
83 $h{$a}-&gt;{$b} = 1;
84 for (keys %h, keys %{$h{$a}}) {
85 print ref($_), &quot;\n&quot;;
86 }</pre>
87 <p>
88 </p>
89 <hr />
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>
93 <p>
94 </p>
95 <hr />
96 <h1><a name="version">VERSION</a></h1>
97 <p>Version 1.32</p>
98 <p>
99 </p>
100 <hr />
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">&nbsp;Tie::RefHash - use references as hash keys</span></strong></big>
106 </td></tr>
107 </table>
109 </body>
111 </html>