The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Sort::Key::LargeInt - sort large integers very fast

SYNOPSIS

  use Sort::Key::LargeInt qw(largeintsort);
  my @data = qw(+8970938740872304
                -12
                98_908_345_309_345_345_353_453_466_545_645_676_567
                ...);
  my @sorted = largeintsort @data;

DESCRIPTION

This module extends the Sort::Key family of modules to support sorting strings containing integer numbers of arbitrary length (referred by this module as large-integers) numerically.

Large-integers must match the following regular expresion:

  /^[+\-]?[\d_]*$/

FUNCTIONS

The functions that can be imported from this module are:

largeintsort @data

returns the large-integer values in @data sorted.

rlargeintsort @data

returns the large-integer values in @data sorted in descending order.

largeintkeysort { CALC_KEY($_) } @data

returns the elements on @array sorted by the large-integer keys resulting from applying them CALC_KEY.

rlargeintkeysort { CALC_KEY($_) } @data

is similar to largeintkeysort but sorts the elements in descending order.

largeintsort_inplace @data
rlargeintsort_inplace @data
largeintkeysort_inplace { CALC_KEY($_) } @data
rlargeintkeysort_inplace { CALC_KEY($_) } @data

these functions are similar respectively to largeintsort, rlargeintsort, largeintsortkey and rlargeintsortkey, but they sort the array @data in place.

SEE ALSO

Sort::Key, Sort::Key::Maker

COPYRIGHT AND LICENSE

Copyright © 2009 by Salvador Fandiño

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.10.0 or, at your option, any later version of Perl 5 you may have available.