- or download this
@bin[@pos] = (1) x @pos; #(undef, undef, 1, undef, 1, undef, 1, undef,
+ undef, 1)
- or download this
$_ ||= 0 for @bin; #(0, 0, 1, 0, 1, 0, 1, 0, 0, 1)
- or download this
my @bin2 = (0) x 15; # assign 15 zeros
@bin2[@pos] = (1) x @pos; # fill in the 1's