> I am trying to get .15 and end up with 0.15. I don't believe that ".15" is a valid floating point value, I think there always has to be at least one digit to the left of the decimal... so the "f" format won't help.
Using a regex might be the easiest way to solve the problem since I don't know that sprintf will help you here. $val = sprintf("%.2f", $val); $val =~ s/^0//; Rob -----Original Message----- From: Wagner, David --- Senior Programmer Analyst --- WGO [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 30, 2003 1:09 PM To: Beginner Perl Subject: sprintf and wanting NO leading zero on a decimal less than 1(ie, .15 prints as .15 and not 0.15) I am trying to get .15 and end up with 0.15. I have tried a number of combinations of sprintf and %f. sprintf "%.2f" sprintf "%2.2f" sprintf "% .2f" sprintf "% 2.f" and I always get a 0.15. Do I just remove with a regex or am I missing something? Running on w2k and AS 5.6.0 Build 623. Thanks. Wags ;) ********************************************************** This message contains information that is confidential and proprietary to FedEx Freight or its affiliates. It is intended only for the recipient named and for the express purpose(s) described therein. Any other use is prohibited. **************************************************************** -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]