A one liner (I'm no true obfuscator):
perl -ne 'undef@_;while($_){$_[0]=($_&1&&1||0).$_[0];$_>>=1}print"@_\n"'
Or a more sensible sub version with the same logic.
sub to_bin { my $num = shift; my $ret = ''; while ($num) { $ret = (($num % 2) ? 0 : 1) . $ret; $num >>= 1; } return $ret; }
In reply to Re: Re: Re: decimal to binary
by repson
in thread decimal to binary
by tsvika_t
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |