Well, All the above said answers are perfectly fine, but just to make it more efficient what we can do is, we can avoid the if statement or ?: operator.
This is because whenever we go for a decision statement, it takes some extra processing time. A solution to avoid using if or ?: is as follows: #!/usr/bin/perl use strict; my @string = ("Even", "Odd"); print $string[$ARGV[0]%2]; Well it might look like the savings in time is less, but if you consider that this code is inside a loop which will run for several iterations, you are sacing lot of time.... Hence the program becomes more efficient. Also if suppose you need to invoke a function depending upon whether a number is Odd or Even, you may simply put the reference of the functions inside the array (which in our example is having "Odd", Even"). So you may simply invoke the function by saying &$array[$ARGV[0]%2].... Well it also has lots more advantages, you may just kickstart your creative horse to run, and use this logic to the maximum extent..... Hope it helps ;) With Best regards, R. Kamal Raj Guptha. -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 03, 2004 6:24 PM To: [EMAIL PROTECTED] Subject: Re: Determining Odd and Even Numbers Thanks everyone! Confidentiality Notice The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain confidential or privileged information. If you are not the intended recipient, please notify the sender at Wipro or [EMAIL PROTECTED] immediately and destroy all copies of this message and any attachments.