in reply to Splitting a String into n-character parts, without using a regex
Of course, this uses a regex and a while, etc...$string='aabbbbbbcccccaaaddeefghhhh'; my @l; push @l, $1.$2 while $string =~ /(\w)(\1*)/g; print join ',', @l; # outputs aa,bbbbbb,ccccc,aaa,dd,ee,f,g,hhhh
|
|---|