Michael Alipio wrote:
Hi,

Hello,

How do I split a word into n subsets?

my $word = "thequickbrown"


If I want three subsets I should be able to create:

the
heq
equ
....
upto
....
own

$ perl -le'
my $word = "thequickbrown";
my $subsets = 3;
print for $word =~ /(?=(.{$subsets}))/g;
'
the
heq
equ
qui
uic
ick
ckb
kbr
bro
row
own



John
--
The programmer is fighting against the two most
destructive forces in the universe: entropy and
human stupidity.               -- Damian Conway

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to