Range::DigitString - Implements ranges of digit strings
use Range::DigitString; # Create a new range my $range = Range::DigitString->new('00-03; 0100-0103', '996-998'); # Test if a value is in range print "in range\n" if $range->in('02'); print "not in range\n" if !$range->in('999'); # Add values to range $range->add('04', '0104', '999'); # Get full list of values my @list = $range->range(); print join q{ }, @list; # Prints: # 00 01 02 03 04 0100 0101 0102 0103 0104 996 997 998 999 # Get collapsed string representation my $string = $range->range(); print "$string\n"; # Prints: # '00-04,0100-0104,996-999' # Get range size my $size = $range->size(); print "$size"; # Prints: 14
This module is intended to be used with ranges of digit strings up to 16 digits in length.
See Range::Object.
There are no known bugs in this module. Please report problems to author, patches are welcome.
Alexander Tokarev <tokarev@cpan.org>.
Copyright (c) 2011 Alexander Tokarev.
This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See perlartistic.
To install Range::Object, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Range::Object
CPAN shell
perl -MCPAN -e shell install Range::Object
For more information on module installation, please visit the detailed CPAN module installation guide.