I would draw your attention to one fact about sprintf function, it results in formatted strings, Perl checks contexts of a variable to determine whether it is a number or a string and hence it even sometimes implicitly apply sprintf(). What I am saying is sprintf() return value is a string, even if we used it on numbers as in:
$variable=sprintf "%0.2f", 3.1415;
the value of $variable would be a formatted-string until you tell Perl to treat it as a number through numeric manipulation or using the int() function to truncate the floating part all of it.
Now that said, read what kennethk has linked to his reply and :)
Excellence is an Endeavor of Persistence.
Chance Favors a Prepared Mind.