in reply to (Golf) Character windows

51 characters: $S=$_;map($S=~/^.{$_}/sg,1..$s-1),/(?=(.{1,$s}))/sg P.S. Oh, you didn't say how the results should be returned... I guess I'm supposed to assign to an array, so this solution is actually 54 characters.

I'm used to the golf challenges where you define a sub that returns the desired results.

Replies are listed 'Best First'.
(MeowChow) Re2: (Golf) Character windows
by MeowChow (Vicar) on Aug 25, 2001 at 01:35 UTC
    This is alot like my first solution, but it doesn't properly deal with windows that are larger than the string length... and it's actually 57 chars - you need to add two more characters to parenthesize the comma'd rvalue, and add a semicolon (since it's not in a sub).
       MeowChow                                   
                   s aamecha.s a..a\u$&owag.print
Re: Re: (Golf) Character windows
by petral (Curate) on Sep 13, 2001 at 02:22 UTC
    56 chars satisfy all the reqs (I think):
    $S=$_;@s=(map($S=~/^.{$_}/sg,1..$s),/(?=.(.{1,$s}))/sg);

      p