The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

Build Status Coverage Status

NAME

List::Range - Range processor for integers

SYNOPSIS

use List::Range;

my $range = List::Range->new(name => "one-to-ten", lower => 1, upper => 10);
$range->includes(0);   # => false
$range->includes(1);   # => true
$range->includes(3);   # => true
$range->includes(10);  # => true
$range->includes(11);  # => false

$range->includes(0..100); # => (1..10)
$range->includes(sub { $_ + 1 }, 0..100); # => (1..11)

$range->excludes(0..100); # => (11..100)
$range->excludes(sub { $_ + 1 }, 0..100); # => (0, 12..100)

DESCRIPTION

List::Range is range object of integers. This object likes 0..10.

METHODS

List::Range->new(%args)

Create a new List::Range object.

ARGUMENTS

$range->includes(@values)

Returns the values that is included in the range.

$range->excludes(@values)

Returns the values that is not included in the range.

$range->all

Returns all values in the range. (likes $lower..$upper) @$range is alias of this.

SEE ALSO

Number::Range Range::Object Parse::Range

LICENSE

Copyright (C) karupanerura.

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

AUTHOR

karupanerura <karupa@cpan.org>