Skip to content

DrHyde/perl-modules-Tie-Hash-Rank

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

86 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation



Tie::Hash::Rank(�U3�s)�er Contributed Perl Documentati�To�in�e::Hash::Rank(3)


N�N�N�NA�A�A�AM�M�M�ME�E�E�E
       Tie::Hash::Rank - A hash which turns values into ranking
       positions

S�S�S�SY�Y�Y�YN�N�N�NO�O�O�OP�P�P�PS�S�S�SI�I�I�IS�S�S�S
         use Tie::Hash::Rank

         tie my %ranks, 'Tie::Hash::Rank';
         %ranks=(
           Adams   => 78,
           Davies  => 35,
           Edwards => 84,
           Thomas  => 47
         );
         print $ranks{Adams};


D�D�D�DE�E�E�ES�S�S�SC�C�C�CR�R�R�RI�I�I�IP�P�P�PT�T�T�TI�I�I�IO�O�O�ON�N�N�N
       This module allows you to tie a hash such that when you
       retrieve values from it, you get the value's rank instead
       of the actual data.  By default, it ranks items
       numerically, with the highest value getting rank 1, and
       given two equal values they will also get the same rank.

       The following named parameters are supported:

       ""ALGORITHM""
           Use "ALGORITHM" to sort items prior to ranking them.
           The default is a reverse-numeric sort.  Specify it
           thus $DATA{$a} <=> $DATA{$b} to do a normal numeric
           sort.  Divining how to do other types of sort is left
           as a trivial exercise for the reader.  See perldoc -f
           sort.

       ""EQUALITYSUFFIX""
           Append "EQUALITYSUFFIX" to the rank of items with
           equal rank.  The default is to have no EQUALITYSUFFIX,
           but a common alternative would be an "=" sign.

       ""EQUALITYPREFIX""
           Prepend "EQUALITYPREFIX" to the rank of items with
           equal rank.  The default is to have no EQUALITYPREFIX,
           but a common alternative would be an "=" sign.

       ""RECALCULATE""
           Can be either "onstore" or "onfetch", and defaults to
           'onstore'.  This determines when the module
           recalculates the ranks.  'onstore' makes it
           recalculate whenever you add a value to the hash, and
           'onfetch' whenever you retrieve a value.  Use this
           option if you need to tune your hash for data which is
           mainly read or mainly written, although it will make
           very little difference for small data-sets.




2001-06-13                 perl v5.6.1                          1





Tie::Hash::Rank(�U3�s)�er Contributed Perl Documentati�To�in�e::Hash::Rank(3)


B�B�B�BU�U�U�UG�G�G�GS�S�S�S
       Plenty, no doubt.  Please tell me if you find any.

A�A�A�AU�U�U�UT�T�T�TH�H�H�HO�O�O�OR�R�R�R
       David Cantrell <david@cantrell.org.uk>

       This module originated as a grotesquely over-engineered
       answer to a trivial question posed by Simon Cozens as an
       example of something you might want to ask when testing
       someone's perl skillz.  An earlier - and less complete -
       version of this module was posted on the London Perl
       Mongers mailing list.

C�C�C�CO�O�O�OP�P�P�PY�Y�Y�YR�R�R�RI�I�I�IG�G�G�GH�H�H�HT�T�T�T
       Copyright 2001 David Cantrell.

       This module is licensed under the same terms as perl
       itself.

S�S�S�SE�E�E�EE�E�E�E A�A�A�AL�L�L�LS�S�S�SO�O�O�O
       _�T_�i_�e_�:_�:_�H_�a_�s_�h(3)




































2001-06-13                 perl v5.6.1                          2


About

Tie::Hash::Rank

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages