Gossamer Forum
Home : General : Perl Programming :

need help with sprintf

Quote Reply
need help with sprintf
I'm having trouble getting sprintf to cooperate with me. I want to take a number such as "4.0234", pad up to one 0, and round to 2 decimals, such that I would arrive at "04.02". Seems I can use "%0.2d" to pad zeroes and "%.2f" to round decimals, but I can't figure out how to combine the two. I'd appreciate some assistance on this. Thanks!
Subject Author Views Date
Thread need help with sprintf lostinva 4675 Apr 15, 2009, 12:40 PM
Thread Re: [lostinva] need help with sprintf
brewt 4547 Apr 15, 2009, 4:44 PM
Post Re: [brewt] need help with sprintf
lostinva 4529 Apr 15, 2009, 6:45 PM