my $i = 1; (push @num, (($num & $i) ? 1 : 0)) and $i<<=1 until $i > $num;