develooper Front page | perl.beginners | Postings from October 2009

Re: split n characters into n chunks

Thread Previous | Thread Next
From:
Dr.Ruud
Date:
October 25, 2009 07:49
Subject:
Re: split n characters into n chunks
Message ID:
20091025103252.19172.qmail@lists.develooper.com
Michael Alipio wrote:

> my $word = "thequickbrown"
> 
> If I want three subsets I should be able to create:
> 
> the
> heq
> equ
> .....
> upto
> .....
> own

   print substr( $word, $-[0], 3 )
     while $word =~ /.(?=..)/g;

-- 
Ruud

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About