Just use printf.
perl -E 'printf "%016b",123;' 0000000001111011
You didn't say what you're trying to achieve and it looks like an XY problem, but you seem to be trying to recreate fixed point maths. Maybe reading up on that may help?
In reply to Re: How to pack and unpack 16 bit decimal with leading zero
by RichardK
in thread [SOLVED] How to pack and unpack 16 bit decimal with leading zero
by thanos1983
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |