in reply to perl Question
The problem isn't the space. The problem is that the results of the printf program add a comma to the end of your variable.
Use the sprintf builtin instead: