There has to be an easier way and there is:
#just two lines my @bits= (0) x 15; $bits[$_] = 1 for @pos; #...and print the output print "<@bits>\n";
outputs <0 0 1 0 1 0 1 0 0 1 0 0 0 0 0>.
Best, beth
In reply to Re: sequence of positions to binary sequence
by ELISHEVA
in thread sequence of positions to binary sequence
by coldy
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |