$ perl -e '$_="aaabbccccddeee"; print $1,$/ while /((.)\2*)/g' # ^^ # || # |+--- \2 # | # \1 aaa bb cccc dd eee #### push @array, $1 while /((.)\2*)/g; #### # THIS IS WRONG @array = $_ =~ /((.)\2*)/g; print join ", " , map {"<$_>"} @array; __END__ , , , , , ,
, , ,