in reply to Decimal Removal


One more method (rounds down):     $int = sprintf "%d", $num;

Or this (rounds up for > .5):     $int = int $num + $num =~ /\.[5-9]/;

--
John.

Replies are listed 'Best First'.
Re: Re: Decimal Removal
by DamnDirtyApe (Curate) on Jun 19, 2002 at 13:50 UTC
    Or, to round to the nearest integer:
    $int = sprintf "%d", ( $num + 0.5 ) ;

    _______________
    D a m n D i r t y A p e
    Home Node | Email