This is a simple thing, but when you need it – you need it. There is no need in implementing a function that does or looking for a module at CPAN. All you are looking for is already there.
#!/usr/bin/perl -w use strict; # Get the number from the command line or use default. my $number = shift || 42; printf "%b\n", $number;
You might want to refresh you memory of
sprintf by flipping though the manual pages.
P.S.: 42 decimal = 101010 binary. Is it cool or what?