sub set_bit_offsets { my @bitmap = split //, unpack('b*', @_); return grep {$bitmap[$_]} 0..$#bitmap; }