Sort::Key::Top::PP - pure Perl implementation of parts of Sort::Key::Top
use Sort::Key::Top::PP 'top'; my @top5 = top 5 => @biglist;
Sort::Key::Top::PP is set of functions for finding the top "n" items in an array by some criteria. It's not as fast as Sort::Key::Top, but it is generally quite a bit faster than sorting the entire array and taking the first "n" items.
This module implements pure Perl equivalents of the following functions as descibed in Sort::Key::Top.
top
topsort
keytop
keytopsort
ntop
ntopsort
nkeytop
nkeytopsort
rtop
rtopsort
rkeytop
rkeytopsort
rntop
rntopsort
rnkeytop
rnkeytopsort
head
nhead
keyhead
nkeyhead
tail
ntail
keytail
nkeytail
By default all functions are exported. If you don't like that, then please specify an explicit list of functions to import, a la:
use Sort::Key::Top::PP qw( top );
Please report any bugs to http://rt.cpan.org/Dist/Display.html?Queue=Sort-Key-Top-PP.
Sort::Key::Top, http://blogs.perl.org/users/stas/2012/12/tmtowtdi-plus-benchmarking.html#comments.
Toby Inkster <tobyink@cpan.org>.
Key parts of the top n selection algorithm (and much egging on) by Stanislaw Pusep (cpan:SYP).
API inspired by Sort::Key::Top by Salvador Fandiño García (cpan:SALVA).
This software is copyright (c) 2012, 2014 by Toby Inkster.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.
To install Sort::Key::Top::PP, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Sort::Key::Top::PP
CPAN shell
perl -MCPAN -e shell install Sort::Key::Top::PP
For more information on module installation, please visit the detailed CPAN module installation guide.