perldoc perlop [download]
Converting between bases is a FAQ:
perldoc -q convert [download]
Specifically: sprintf
In reply to Re: binary converter by toolic in thread binary converter by perlnoobz