sub
DELETE {
my
(
$self
,
$key
) =
@_
;
return
undef
unless
exists
$self
->[0]{
$key
};
$key
eq
$self
->[1][
$_
] and
splice
@{
$self
->[1]},
$_
, 1 and
last
for
0 .. $
return
delete
$self
->[0]{
$key
};
}
sub
EXISTS {
exists
$_
[0][0]{
$_
[1]} }
sub
FETCH {
$_
[0][0]{
$_
[1]} }
sub
FIRSTKEY {
$_
[0][2] = 0;
&NEXTKEY
;
}
sub
NEXTKEY {
$_
[0][2] <= $
sub
STORE {
my
(
$self
,
$key
,
$value
) =
@_
;
push
@{
$self
->[1]},
$key
unless
exists
$self
->[0]{
$key
};
$self
->[0]{
$key
} =
$value
;
}
sub
TIEHASH {
my
$self
=
bless
[{}, [], 0],
shift
;
$self
->STORE(
shift
,
shift
)
while
@_
;
return
$self
;
}
1;