in reply to substring within range

Just for fun, using an array slice instead of a loop (quickly tested under the Perl debugger):
main::(-e:1): 42 DB<1> $input = "The quick red fox jumped over the lazy brown dog."; DB<2> $spec = "3-6,9-13,17-20"; DB<3> $spec =~ s/\-/../g; DB<4> @in = split //, $input; DB<5> print "@in"; T h e q u i c k r e d f o x j u m p e d o v e r t h e l +a z y b r o w n d o g . DB<6> print @in[eval ($spec)]; qui red jum DB<7>
Just 3 lines of code besides the initializations.

Now, of course, since array subscripts start at 0, I am counting the letters from 0. If we need counting letters from 1, not 0, we can just add an empty element at the beginning of the array:

DB<7> unshift @in, ""; DB<8> print @in[eval ($spec)]; e quk redx ju

Je suis Charlie.