Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

Re: How does while works with filehandles?

by rjt (Deacon)
on Dec 02, 2012 at 18:40 UTC ( #1006744=note: print w/replies, xml ) Need Help??


in reply to How does while works with filehandles?

Have a look at the examples in Perl I/O Operators. I'd recommend you read the entire section, but the most relevant snippets that most directly answer your question are probably:

In scalar context, evaluating a filehandle in angle brackets yields the next line from that file (the newline, if any, included), or undef at end-of-file or on error.
...
The following lines are equivalent:
while (defined($_ = <STDIN>)) { print; } while ($_ = <STDIN>) { print; } while (<STDIN>) { print; } for (;<STDIN>;) { print; } print while defined($_ = <STDIN>); print while ($_ = <STDIN>); print while <STDIN>;

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006744]
help
Chatterbox?
[Corion]: (in the sense of not returning 404 errors)
[1nickt]: Corion Surely you have one or more lying around?
[Corion]: 1nickt: Not in the general sense... I only have very specific crawlers, but not a simple crawler like that ;) But maybe that would be a good application/( stress) test for Future::HTTP to parallelize

How do I use this? | Other CB clients
Other Users?
Others surveying the Monastery: (7)
As of 2017-10-18 11:25 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My fridge is mostly full of:

















    Results (244 votes). Check out past polls.

    Notices?