Home : General : Perl Programming :

General: Perl Programming: Re: [zeshan] rounding the figures: Edit Log

Here is the list of edits for this post
Re: [zeshan] rounding the figures
Code:
my $rounded = int($line + .5);

Or to work with negative numbers also:

Code:
my $rounded = int($line + .5 * ($line <=> 0));

Last edited by:

Paul: Apr 29, 2003, 2:34 PM

Edit Log: