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 function which returns a
formatted string, printf goes a step further and prints the string.
They're documented in perlfunc, but this example may be all you need:

 my $result = sprintf "%.3f", $buf/25400;

Hope this helps!

--Tom Phoenix
Stonehenge Perl Training

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to