See perldoc -f sprintf and perldoc -f printf.
In reply to Re: Formating Numbers Preceding 0's by Somni in thread Formating Numbers Preceding 0's by ~~David~~