Number::Rangify - Optimize a list of values into ranges
version 1.100860
use Number::Rangify 'rangify'; my @list = (1, 2, 3, 5, 7, 9, 10, 11, 15); my @ranges = rangify(@list); for my $range (@ranges) { printf "%s-%s\n", $range->Size; }
This module provides a function that can optimize a list of values into range objects.
Takes a list of values and makes them into ranges.
For example:
rangify(1, 2, 3, 5, 7, 9, 10, 11, 15);
returns the following ranges:
1-3 5-5 7-7 9-11 15-15
It returns a list (in list context) or an array reference (in scalar context) of Set::IntRange objects.
Duplicate values in the input list are ignored.
See perlmodinstall for information and options on installing Perl modules.
No bugs have been reported.
Please report any bugs or feature requests through the web interface at http://rt.cpan.org/Public/Dist/Display.html?Name=Number-Rangify.
The latest version of this module is available from the Comprehensive Perl Archive Network (CPAN). Visit http://www.perl.com/CPAN/ to find a CPAN site near you, or see http://search.cpan.org/dist/Number-Rangify/.
The development version lives at http://github.com/hanekomu/Number-Rangify/. Instead of sending patches, please fork this project using the standard git and github infrastructure.
Marcel Gruenauer <marcel@cpan.org>
This software is copyright (c) 2007 by Marcel Gruenauer.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Number::Rangify, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Number::Rangify
CPAN shell
perl -MCPAN -e shell install Number::Rangify
For more information on module installation, please visit the detailed CPAN module installation guide.