in reply to string manipulation
Splitting on 1's, then counting with length.
use strict; use warnings; my $string = "010011100001110110100110111000001"; my $newstring = join ",", map { length $_ } split /1+/, $string; print "$newstring\n"; [download]