5 Tie::RefHash - use references as hash keys
11 tie HASHVARIABLE, 'Tie::RefHash', LIST;
17 This module provides the ability to use references as hash keys if
18 you first C<tie> the hash variable to this module.
20 It is implemented using the standard perl TIEHASH interface. Please
21 see the C<tie> entry in perlfunc(1) and perltie(1) for more information.
26 tie %h, 'Tie::RefHash';
32 %h = ($a => 1, $b => 2, $c => 3, $d => 4, $e => 5);
42 Gurusamy Sarathy gsar@activestate.com
46 Version 1.21 22 Jun 1999
50 perl(1), perlfunc(1), perltie(1)
64 $s->STORE(shift, shift);
71 (ref $k) ? $s->[0]{"$k"}[1] : $s->[1]{$k};
77 $s->[0]{"$k"} = [$k, $v];
87 (ref $k) ? delete($s->[0]{"$k"}) : delete($s->[1]{$k});
92 (ref $k) ? exists($s->[0]{"$k"}) : exists($s->[1]{$k});
97 keys %{$s->[0]}; # reset iterator
98 keys %{$s->[1]}; # reset iterator
107 if (($k, $v) = each %{$s->[0]}) {
108 return $s->[0]{"$k"}[0];
114 return each %{$s->[1]};