in reply to binary problem

Try:
my @counts = map { length } $string =~ /1(0*)/g;
Basically, capture all the zeros, then map the length function on each, and return that.

Update: To get a count of characters after each 1, you could do something like

my @counts = map { length } $string =~ /1(?=(.*))/g;
We want to use the greediness of .*, so we do. We use look-ahead so that we can count the 1's that follow, but not eat them.

------
We are the carpenters and bricklayers of the Information Age.

Don't go borrowing trouble. For programmers, this means Worry only about what you need to implement.