Thanks for great answers. Maybe, part of my confusion was because first "push" in faq code is unnecessary - why not replacing both lines
push @ints, 0 if $bits =~ s/^(\d)// && $1; push @ints, pos $bits while $bits =~ /1/g;
with
push @ints, pos($bits)-1 while $bits =~ /1/g;And it's faster, if i'm not mistaken with how i checked it with Benchamrk module.
In reply to Re^2: Confusion about code sample in perlfaq4
by vr
in thread Confusion about code sample in perlfaq4
by vr
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |