perlquestion
vr
<p>I'm confused about code sample from here: </p>
<p>[doc://perlfaq4#How-do-I-manipulate-arrays-of-bits?]</p>
<p>They say:</p>
<blockquote>...given a vector in $vec , you can get those bits into your @ints array:</blockquote>
<p> and give following code as "fast general algorithm" </p>
<code>
use integer;
my $bits = unpack "b*", $vec;
push @ints, 0 if $bits =~ s/^(\d)// && $1;
push @ints, pos $bits while($bits =~ /1/g);
</code>
<p>What are they trying to do with two lines starting with push operators? Don't they want to get a list "e.g. ( 1, 0, 0, 1, 1, 0 ... )" as stated in the beginning of that section, i.e. do reverse conversion? They can't do it with this code, do they?</p>