From: ken@forum.swarthmore.edu (Ken Williams)
Newsgroups: comp.lang.perl.announce,comp.lang.perl.modules
Subject: New module: Tie::LLHash.pm (ordered hashes)
Followup-To: comp.lang.perl.modules
Date: 14 May 1998 15:03:39 GMT
Organization: The Math Forum
Message-ID: <6jf14b$jcp$1@news.neta.com>
Hi,
The uploaded file
Tie-LLHash-0.01.tar.gz
has entered CPAN as
file: $CPAN/authors/id/KWILLIAMS/Tie-LLHash-0.01.tar.gz
size: 3558 bytes
md5: fdfe60855a65dcb763ad32f86db7b614
Here's a snippet from the documentation:
DESCRIPTION
This class implements an ordered hash-like object. It's a cross between
a Perl
hash and a linked list. Use it whenever you want the speed and structure of a
Perl hash, but the orderedness of a list.
Don't use it if you want to be able to address your hash entries by number,
like you can in a real list (i.e. $list[5]).
See also Tie::IxHash by Gurusamy Sarathy. It's similar (it does ordered
hashes), but it has a different internal data structure and a different
flavor
of usage. It makes your hash behave more like a list than this does.
SYNOPSIS
use Tie::LLHash;
tie (%hash, "Tie::LLHash"); # A new empty hash
# Add some entries:
(tied %hash)->first('the' => 'hash');
(tied %hash)->insert('here' => 'now', 'the');
(tied %hash)->first('All' => 'the');
(tied %hash)->insert('are' => 'right', 'the');
(tied %hash)->insert('things' => 'in', 'All');
$value = $hash{'things'}; # Look up a value
$hash{'here'} = 'NOW'; # Set the value of an EXISTING RECORD!
$key = (tied %hash)->key_before('in'); # Returns the previous key
$key = (tied %hash)->key_after('in'); # Returns the next key
# Luxury routines:
$key = (tied %hash)->current_key;
$val = (tied %hash)->current_value;
(tied %hash)->next;
(tied %hash)->prev;
(tied %hash)->reset;
------- End of forwarded message -------