Hi,

$num += $num % 2;

this increments $num if $num modulo 2 is 1
(ie. if $num was odd)

regards.

"Zielfelder, Robert" a écrit :
> 
> Greetings,
> 
> I am trying to write a script that at one point needs to look at a number
> and divide it by two.  The results must always be an integer, but the
> numerator can potentially be an odd number.  What I want to do is if the
> numerator is odd, increment it to the next highest even number.  Is there a
> function in PERL that will allow me to test weather or not an integer is odd
> or even so that I can increment the number before I do the division?
> 
> Rz
> 
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to