in reply to Re: setting a variable from printf
in thread setting a variable from printf

sprintf FORMAT, LIST

Returns a string formatted by the usual printf conventions of the C library function sprintf.

For example:

# Format number with up to 8 leading zeroes
$result = sprintf("%08d", $number);

# Round number to 3 digits after decimal point
$rounded = sprintf("%.3f", $number);