use constant COLWIDTH => 5; $int = 5; printf "%0" . COLWIDTH . "i", $myInt;