
Tie::Hash::Longest - A hash which knows its longest key and value

use Tie::Hash::Longest;
tie my %hash, 'Tie::Hash::Longest';
%hash = (
a => 'ant',
b => 'bear',
elephant => 'e'
);
# prints elephant
print tied(%hash)->longestkey();
# prints bear
print tied(%hash)->longestvalue();

This module implements a hash which remembers its longest key and value. It avoids rescanning the entire hash whenever possible.

The following methods are available. Call them thus:
tied(%my_hash)->methodname();
longestkeyReturn the longest key.
longestvalueReturn the longest value.

David Cantrell <david@cantrell.org.uk>. I welcome feedback.

Copyright 2001 David Cantrell.
This module is licensed under the same terms as perl itself.

Tie::Hash(3)