If the first if condition is false then next if condition has to be cleed .. Is this the corect way? Succeeding if condition has to be called if preceeding condition fails, It has to go on till the if conition is true

Re: [Tejas] How to conditionally write 10 if statements at a time
[In reply to]

Can't Post

Sorry that I confused you. I meant to show how your fragment of code works in a loop. I do not know anything about your program so I made up a 'for' loop for the demo. "COUNT" is a statement label on that "for" statement. My "next" statement refers to that label. The label is not necessary, but it makes clear exactly what the "next" does. Good Luck, Bill

Above is the excat piece of code i am working on, Im really curious to see how the while loop can be replaced as per you. And also how do i print the COUNT , Can u please explain me the importace of COUNT here.

Also the wierd hardcoding of the numbers, tried using ceil and floor but doesnt work , so had to hard code.

Re: [Tejas] How to conditionally write 10 if statements at a time
[In reply to]

Can't Post

Your last question requires a rather long answer. In part, it is hidden in the FAQs and their references.

Code

perldoc -q "Why do I get long decimals"

The short summary is that is never a good idea to test for exact equality of floating point numbers. In you case use:

Code

&& abs( $avg_etid - 369.66667 ) < .00001

You may find that you need a similar fix for your other tests. They should be alright if they are always integers.

I did not intend you to replace the loop, only the if's. I did recommend adding a label to your loop. (I choose "COUNT" which probably was a bad choice.) Remove your "next COUNT" statement. You will do one print or the other then go to the next line automatically.

$count is still an issue. You are now getting its value from the eighth field of your input line. This is probably not what you mean. I do not know exactly what you want to count so I cannot show you how to do it.

Re: [Tejas] How to conditionally write 10 if statements at a time
[In reply to]

Can't Post

I definitely agree, reading tutorials, manuals, hand books, reference books and other materials is very important to increase knowledge coverage, but the most essential thing when learning a new programming language is to practice on real cases, where you really need to find a solution, because that 's where you get deeper knowledge, which is at least as important as a wide knowledge coverage. Nothing can replace real experience on real problems.

Having said that, don't get me wrong, a wide knowledge coverage is also essential, because it is what will tell you that "there is/must be/ might be/ ought to be/ " a better solution to your problem. And that is a key to progressing: you've read somewhere about a better way of doing things, maybe you don't remember the details, but you remember enough to test out new ways of doing things, that's where you might progressively become really knowledgeable, or perhaps even an expert.