$string = ('0' x ($wanted - $current)) . $string; #### sprintf "%0${len}d", $number;