Beefy Boxes and Bandwidth Generously Provided by pair Networks
The stupid question is the question not asked
 
PerlMonks  

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

by armstd (Friar)
on Jun 01, 2011 at 15:14 UTC ( #907651=note: print w/replies, xml ) Need Help??


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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://907651]
help
Chatterbox?
[Eily]: upper ground :P
[marto]: erix [id://1193617| pretty much
[marto]: err pretty much

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2017-06-29 13:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (665 votes). Check out past polls.