- or download this
my $t = 0;
my @x = grep $t^=1, split /(?<=(.))(?!\1)/, $x;
- or download this
my @x;
push(@x, $1) while $x =~ /((.)\2*)/g;
- or download this
my $t = 0;
my @x = grep $t^=1, $x =~ /((.)\2*)/g;
- or download this
my $t = 0;
my @x = grep $t^=1, map /((.)\2*)/g, $x;