in reply to Problem in using range operator

Your inner for loop is processing the same line twice (or more precisely: it processes the same line the same number of times as the total number of rules you have, in this case, two).

Sounds like what you need is a flag to indicate either that you are currently between a statment declaration and end or to keep track of which statement you are currently in.

Is it necessary for you to use the range operator to grab the statements (e.g. A, B, C?)

Replies are listed 'Best First'.
Re^2: Problem in using range operator
by tariqahsan (Beadle) on May 04, 2005 at 03:13 UTC
    Actually here I am using the range operator more of a flipflop boolean state operator for the left and right operand. I am using the STMT?=BEGIN and STMT?=END as begin and end markers in the data file. My problem is I can have any number of these sort of blocks. The outer most block is the RULE & END. This too can be in multiple numbers. I am using the NUMOFRULES to have the number of the STMT? blocks in the data file. I know that the for loop is printing the same line as many times as NUMOFRULES value. I tried using flags. But could'nt get it right.