Help for this page

Select Code to Download


  1. or download this
    my $str= "aaabbccccdd eee";
    my @list;
    ...
        push @list, substr( $str, $pos, pos($str)-$pos );
        $pos= pos($str);
    }
    
  2. or download this
    my @list= split /(?<=(.))(?!\1)/, "aaabbccccdd eee";
    @list= @list[ map 2*$_, 0..@list/2-1 ];