try to take a look at the 'floor' and 'ceil' in the posix module
they will do exactly what you want!
POSIX qw(ceil floor)
perldoc posix
Kind regards,
Jos Boumans
Craig Moynes/Markham/IBM wrote:
> I looked through my book (perl nutshell) and PP has not arrived yet, so I
> will ask here.
>
> I have an number that needs to be rounded to the nearest whole number.
> This is my solution:
>
> if ( $archives_needed =~ /\.\d+/ )
> {
> ($remainder = $archives_needed) =~ s/\d+(\.
> \d+)/$1/;
> $archives_needed += $remainder;
> $archives_needed =~ s/\.\d+//;
> }
>
> Is there an easier way (or more efficent). This is more a curiosity than
> anything else.
>
> Thanks perl junkies,
>
> -----------------------------------------
> Craig Moynes
> [EMAIL PROTECTED]