in reply to Internally, how do for() and while() differ?

Do they really?

No.

  1. The former places the readline in a list context, slurps the whole file and then processes that list in the loop, one line at a time.
  2. The latter places the readline in a scalar context, reads one line at a time and then prints it before looping back to read the next line.

With the rise and rise of 'Social' network sites: 'Computers are making people easier to use everyday'
Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
"Science is about questioning the status quo. Questioning authority". I knew I was on the right track :)
In the absence of evidence, opinion is indistinguishable from prejudice.
  • Comment on Re: Internally, how do for() and while() differ?

Replies are listed 'Best First'.
Re^2: Internally, how do for() and while() differ?
by stevieb (Canon) on Oct 27, 2015 at 13:31 UTC

    Thank you. That had slipped my mind. It makes total sense.