in reply to [SOLVED] How to pack and unpack 16 bit decimal with leading zero

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?