in reply to sequence of positions to binary sequence
my @pos = (2,4,6,9); my $bin = 0; for (my $i = 0; $i < scalar @pos; $i++) { $bin |= 1 << $pos[$i]; } # Printing out the result is left as a follow-on exercise...
--
use JAPH;
print JAPH::asString();
|
|---|