# You did this, and it works: printf STDOUT ("\n%" . $digitprecision . "s\n", $newvalue); # I suggested this, and it works, too: printf STDOUT ("\n%${digitprecision}s\n", $newvalue);