in reply to Force currency view

I just use a regex to see if it's one or two digits at the end (after the period), and if it's one, I add a 0, like this:

$zero = "0"; $total =~ s/\.(\d)$/.$1$zero/g;

I'm sure there's a way to specify the digit "0" after the $1, but I can't think of it right off, so I just use another string set to 0 for it.

Update: I might add that you can use print formatting, but that only formats the output at that one point, for one reason. What if you need the data formatted for something else? One example (which I have to use a LOT) is if you're inserting the data into a MySQL table.