in reply to Using pack with data of odd lengths

Your other tools are using pack/unpack to convert bits into perl strings of bits like "1..." and "0..." and using vec() to toggle specific bits. vec() only works when your chunks are powers of two.

my $piece_one_six_bits = '001100'; my $piece_two_six_bits = '001100'; my $piece_three_four_bits = '0101'; # Ugly, eh? my $packaged_data = pack 'B*', "$piece_one_six_bits$piece_two_six_bits +$piece_three_four_bits";

⠤⠤ ⠙⠊⠕⠞⠁⠇⠑⠧⠊