fork download
  1. #!/usr/bin/perl
  2. use strict;
  3. use warnings;
  4. use feature 'say';
  5.  
  6. my $bin_string = '10000111000011';
  7. my @groups = split /(?<=0(?!0)|1(?!1))/, $bin_string;
  8.  
  9. say "@groups";
Success #stdin #stdout 0s 6132KB
stdin
Standard input is empty
stdout
1 0000 111 0000 11