use warnings; use strict; use Set::IntSpan; my $set = Set::IntSpan->new("1,2,5,6,9,10,41-56"); for my $x (1,2,3,42,100) { print "$x is ", $set->member($x)?"":"NOT ", "in the set\n"; } __END__ 1 is in the set 2 is in the set 3 is NOT in the set 42 is in the set 100 is NOT in the set