in reply to setting a variable from printf

Use sprintf ...

Replies are listed 'Best First'.
Re: Re: setting a variable from printf
by Mago (Parson) on Jul 08, 2003 at 21:35 UTC
    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);