perl -e 'printf "%.0d\n", $ARGV[0]/2 if @ARGV' 5

Weird why doesn't this work they way I expect it to?
it returns 2 not 3.


> -----Original Message-----
> From: Zielfelder, Robert 
> [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, October 09, 2002 10:58 AM
> To: Perl Beginners List (E-mail)
> Subject: Odd and even numbers
> 
> 
> 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

----------------------------------------------------------------------------
--------------------
The views and opinions expressed in this email message are the sender's
own, and do not necessarily represent the views and opinions of Summit
Systems Inc.


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

Reply via email to