printf will round. Try it:
printf ("should be 25.8 : %.1f$/", 25.79);
prints:
should be 25.8 : 25.8
Just one caveat here: as I understand it, sprintf() will not round the
decimal, it will just truncate it, so if you need to round up or down
the number, I would suggest looking through the math
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of
Tom Phoenix
Sent: Saturday, July 15, 2006 3:22 PM
To: Ralph H. Stoos Jr.
Cc: beginners perl
Subject: Re: Help with Stupid question
>> On 7/15/06, Ralph H. Stoos Jr. <[EMAIL PROTECTED]> wrote:
>
On 7/15/06, Ralph H. Stoos Jr. <[EMAIL PROTECTED]> wrote:
I want to know if / how the $buf/25400 part can
be formatted to be a number with only two or three decimal places.
In Perl, that kind of formatting is generally done with printf or its
related function sprintf. Where sprintf is a functi