in reply to Fast string construction

I wonder if you could use vec instead. I don't think you would need to initialise the string then as it would, I think, be automatically extended at need. I think it also stores bits in the same order as pack q{N}, ...

knoppix@Microknoppix:~$ perl -E ' > vec( $str, 1, 32 ) = 0xfffff; > say unpack q{b*}, $str; > vec( $str, 3, 32 ) = 0xf; > say unpack q{b*}, $str;' 0000000000000000000000000000000000000000111100001111111111111111 0000000000000000000000000000000000000000111100001111111111111111000000 +0000000000000000000000000000000000000000000000000011110000 knoppix@Microknoppix:~$ perl -E ' > vec( $str, 0, 32 ) = 0xfffff; > say unpack q{b*}, $str; > say unpack q{b*}, pack q{N}, 0xfffff;' 00000000111100001111111111111111 00000000111100001111111111111111 knoppix@Microknoppix:~$

I hope this is useful.

Cheers,

JohnGG