Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: How does while works with filehandles?

by tobyink (Abbot)
on Dec 02, 2012 at 19:22 UTC ( #1006749=note: print w/replies, xml ) Need Help??

Help for this page

Select Code to Download


  1. or download this
    $ echo -n "0" | perl -E'while(<>) { say "GOT" }'
    GOT
    $ echo -n "0" | perl -E'while(<> and 1) { say "GOT" }'
    $ 
    
  2. or download this
    $ echo "Hello" | perl -E'while(<>){ print $_ }'
    Hello
    $ echo "Hello" | perl -E'<>; print $_'
    $
    
  3. or download this
    while (defined($_ = <$fh>))
    

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1006749]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (5)
As of 2017-11-18 14:47 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    In order to be able to say "I know Perl", you must have:













    Results (277 votes). Check out past polls.

    Notices?