in reply to sequence of positions to binary sequence
If you are seeking for efficiency, you may be interested in manage your binary array as a bit vector. See vec and unpack. There is also a Bit::Vector module, but I've never used it.
citromatik