The idea is quite simple :
Just split up the string at every 1 and then count how long the sequences of zeroes are that you got back. As a one-liner, this looks like
perl -e "print length,qq(\n) for split /1/,'10000000000001000000000000 +00100';"
As a full-blown Perl program, this would look somewhat like this :
#!/usr/bin/perl -w use strict; while (<DATA>) { my @bits = split /1/; # every string starts with a 1, so # pop the first zero off of @bits pop @bits; print join( ",", @bits ), "\n"; }; __DATA__ 1000000000000100000000000000100
perl -MHTTP::Daemon -MHTTP::Response -MLWP::Simple -e ' ; # The $d = new HTTP::Daemon and fork and getprint $d->url and exit;#spider ($c = $d->accept())->get_request(); $c->send_response( new #in the HTTP::Response(200,$_,$_,qq(Just another Perl hacker\n))); ' # web
In reply to Re: binary problem
by Corion
in thread binary problem
by Anonymous Monk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |