my $str= "aaabbccccdd eee"; my @list; my $pos= 0; while( $str =~ /(?<=(.))(?!\1)/g ) { push @list, substr( $str, $pos, pos($str)-$pos ); $pos= pos($str); }