On 6/8/07, ash <[EMAIL PROTECTED]> wrote:
Hello there!

I need to remove decimal points from numbers. For eg 1.23 or 1.77
would be just 1. Any suggestion is appreciated. Thank you.

If you just want the integer part (aka floor) then use the int function.

my $n = 1.23;
my $i = int $n;

If you want to round to the nearest integer add 0.5 to it before using int.

my $m = 1.77;
my $n = 1.23;
my $i = int($m+0.5);
my $j = int($n+0.5);

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


Reply via email to