http://www.perlmonks.org?node_id=907651


in reply to Re^2: Trying to do multiple while loops on the same input file
in thread Trying to do multiple while loops on the same input file

Well, I think I have to agree with Perl on this one. Its behavior is consistent. Once you reach the end of the file, "$line = <INPUTFILE>" is false. False ending the first loop, and still false at the beginning of any additional loops. It doesn't fail anything, it just doesn't change anything magically between loops either.

It sounds like you would like it to be false, and then next loop reset back to the beginning of the file? That does not seem consistent to me. You'll note that you can do anything you like with INPUTFILE inside your while loop, and what would you expect the while() to do then?

There is no explicit or implied relationship between your loop and what your loop does internal to Perl. Nor should there be imo. That's entirely for your code to establish.

--Dave

  • Comment on Re^3: Trying to do multiple while loops on the same input file