http://www.perlmonks.org?node_id=617110


in reply to Re: finding number of contiguous letters
in thread finding number of contiguous letters

Well, just chain a map-based solution like "mine" with the usual grep-based "uniq" or absorb the latter into the map():

my %saw; my @parts = map { my $s=substr $str, $_, 3; $saw{$s}++ ? () : $s } 0..length($str)-3;