in reply to sequence of positions to binary sequence
> perl -e ' @pos = (2,4,6,9); for $i (0..14) { print --$| and --$| or next if grep { $_ == $i } @pos; print $|; }' 001010100100000 [download]