$dig=4; $inc=5; $res=sprintf("%0$digd", $inc); print $res; #output should be #0005