in reply to Re: Base10 to Base2.
in thread Base10 to Base2.

Another implementation of (essentially) this same algorithm:
print "Enter a decimal number: "; chomp( $decimal = <STDIN> ); $binary = ''; while( $decimal ){ $binary = $decimal%2 . $binary; $decimal = int( $decimal/2 ); } print STDOUT $binary;
I think tadman's answer in the previous thread was more elegant (but apparently it only works in 5.6 or higher):
my ($binary) = sprintf ("%08b", $decimal);
--

Love justice; desire mercy.