my $maxind = 10; print "maxind=$maxind\n"; for my $rstr ( qw[ x 1-2-3 0 10 11 4 4-6 7- -2 -10 -11 -0 10- 11- ] ) { my @ret = eval{ range_to_list( $maxind, $rstr ) }; print "rstr:$rstr:", $@ ? "...exc:$@" : "...ret:@ret:"; } my @apples = qw[ :zero: :one: :two: :three: :four: ]; print "apples ", @apples[range_to_list( $#apples, "1-3" )], "\n";