NAME
Tie::ListKeyedHash - A system allowing the use of anonymous arrays as keys to a hash.
SYNOPSIS
use Tie::ListKeyedHash;
[$X =] tie %hash, 'Tie::ListKeyedHash';
$hash{['key','items','live']} = 'Hello!';
$hash{['key','trees','grow']} = 'Goodbye!';
print $hash{['key','items','live']},"\n";
my (@list) = keys %{$hash{['key']}};
print "@list\n";
untie %hash ;
Alternatively keys are accessible as:
$hash{'key','items','live'} = 'Hello!';
This way slows down the accesses by around 10% and cannot
be used for keys that conflict with the value of '$;'.
Also usable via the object interface methods 'put',
'get','exists','delete','clear'. The object interface
is about 2x as fast as the tied interface.
DESCRIPTION
Tie::ListKeyedHash ties a hash so that you can use a reference to an array as the key of the hash.
CHANGES
0.41 09 Jun 1999
Minor documentation changes.
0.40 04 May 1999
Yet Another Rename to Tie::ListKeyedHash. Final rename, I promise.
0.30 04 May 1999
Renamed to 'Tie::ListKeyedHash' after discussion on comp.lang.perl.module and added (on the suggestion of Ilya Zakharevich, <ilya@math.ohio-state.edu>) support for using the tie hash as $hash{'key1','key2','key3'} as well as its native mode of $hash{['key1','key2','key3']}
0.20 30 April 1999
Initial public release as 'Tie::ArrayHash'
METHODS
STORE($key_ref,$value);
-
Stores the $value into the arrayhash location pointed to by the $key_ref array reference.
If the '$key_ref' is a $; seperated text string instead of an array reference, it splits it on $; and uses the resulting array as the actual key.
FETCH($key_ref);
-
Returns the value pointed to by the $key_ref array reference.
If the '$key_ref' is a $; seperated text string instead of an array reference, it splits it on $; and uses the resulting array as the actual key.
DELETE($key_ref);
-
Deletes a specified item from the arrayhash.
If the '$key_ref' is a $; seperated text string instead of an array reference, it splits it on $; and uses the resulting array as the actual key.
EXISTS($key_ref);
-
Returns true if the specified arrayhash key exists, false if it does not.
If the '$key_ref' is a $; seperated text string instead of an array reference, it splits it on $; and uses the resulting array as the actual key.
exists([@key_list]);
-
Returns true of the specified hash element exists, false if it does not. Just as with normal hashes, intermediate elements will be created if they do not already exist.
The strange elsif construct provides a performance boost for shallow keys.
get([@key_list]);
-
Returns the contents of the object field denoted by the @key_list. This is a way of making arbitrary keys that act like hashes, with the 'hardwiring' requirements of hashes. The routine returns the the contents addressed by 'key1','key2','key3',...
The strange elsif construct provides a performance boost for shallow keys.
put([@key_list],$value);
;-
Sets $value as the contents of the object field denoted by the @key_list. This is a way of making arbitrary keys that act like hashes, without the 'hardwiring' requirements of hashes.
The strange elsif construct provides a performance boost for shallow keys.
delete([@key_list]);
;-
Deletes the object field denoted by the @key_list.
This is a way of making arbitrary keys that act like hashes, without the 'hardwiring' requirements of hashes.
The strange elsif construct provides a performance boost for shallow keys.
BUGS
To Be Determined.
TODO
FIRSTKEY, NEXTKEY have to be tested completely.
AUTHORS
Benjamin Franz <snowhare@nihongo.org>
VERSION
Version 0.40 May 1999
Copyright (c) Benjamin Franz 1999. All rights reserved.
This program is free software; you can redistribute it
and/or modify it under the same terms as Perl itself.
SEE ALSO
perl perltie