Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Internally, how do for() and while() differ?

by BrowserUk (Patriarch)
on Oct 27, 2015 at 00:04 UTC ( [id://1146042]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1146042]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (1)
As of 2024-04-25 00:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found