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


Tie-Hash-Longest documentation  | view source Contained in the Tie-Hash-Longest distribution.

Index


NAME

Top

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

SYNOPSIS

Top

  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();

DESCRIPTION

Top

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

METHODS

Top

The following methods are available. Call them thus:

tied(%my_hash)->methodname();

longestkey

Return the longest key.

longestvalue

Return the longest value.

AUTHOR

Top

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

COPYRIGHT

Top

SEE ALSO

Top

Tie::Hash(3)


Tie-Hash-Longest documentation  | view source Contained in the Tie-Hash-Longest distribution.