in reply to Using array elements for a file search
Code review aside, your example is interesting because you seem to be trying to capture every line of your input file and write it to another file (which can be done in a simpler way than this).
The output to STDOUT looks like it does because you read $INFILE to the end when you checked for the letter "A", so the next time you try to while <$INFILE> {...} for letter "B" the pointer is already at EOF and the while <$INFILE> {...} isn't entered.
|
|---|