On Sep 17, NYIMI Jose (BMB) said:

>Let say the known length is 2.
>If the string is 'abcd', my array should be ('ab', 'dc')
>And if my string is 'abcdef', my array should be ('ab', 'dc', 'ef').

I'd just use:

  @groups = $string =~ /../g;  # use ... for three, or .{3}, etc.

You don't need capturing parens in this case.

-- 
Jeff "japhy" Pinyan      [EMAIL PROTECTED]      http://www.pobox.com/~japhy/
RPI Acacia brother #734   http://www.perlmonks.org/   http://www.cpan.org/
<stu> what does y/// stand for?  <tenderpuss> why, yansliterate of course.
[  I'm looking for programming work.  If you like my work, let me know.  ]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to