in reply to Using loops inside an 'if' statement

There is no reason why a while loop cannot exist within the block that gets executed when an if statement evaluates true.

However, both of your examples had syntax errors in them, leading me to wonder if that's where you're going to find the real source of the problem.

For the record, it's
while( <FILE> ) {...
not

while (<FILE)> {...

Dave

"If I had my life to do over again, I'd be a plumber." -- Albert Einstein