I had forgotten about vec :-(.
I need the least significant bit in the rightmost position.
So what I use now is:
$binary = chr(0) x 8; vec($binary, $_, 1) = 1 for (SOME, CONSTANTS); $binary = reverse $binary;
In reply to Re: how to set bits in an arbitrary length string
by busunsl
in thread how to set bits in an arbitrary length string
by busunsl
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |