in reply to binary conversion

Probably not what they want, but the best I could come up with on short notice without cheating and just telling Perl to convert directly.

use strict; use warnings; my $nd = 186; my $nb = ''; for (reverse (0..7)) { if ($nd >= 2**$_) { $nb .= '1'; $nd -= 2**$_; } else { $nb .= '0'; } } print $nb;