in reply to Re^2: combinations of given string
in thread combinations of given string
Given a bit pattern with n-bits set (eg. 0x7 == 0b111000), _next() produces the next number that contains that same number of bits sets. (eg. 0b110100 ). And when you pass that value in it produces the next (eg. 0b101100 ); and so on.
[0] Perl> $n = 0x7; print unpack 'b6', pack 'V', $n while ( $n = _next +( $n ) ) < ( 0x7 << 3 );; 110100 101100 011100 110010 101010 011010 100110 010110 001110 110001 101001 011001 100101 010101 001101 100011 010011 001011
Thus, replacing 1s with successive characters from the input charset, and 0s with '-', results in the required output.
|
|---|