Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re^4: reading several lines in a gulp

by wind (Priest)
on Apr 27, 2011 at 18:52 UTC ( [id://901632]=note: print w/replies, xml ) Need Help??


in reply to Re^3: reading several lines in a gulp
in thread reading several lines in a gulp

Good use of //. Confirmed that it works:

use strict; use warnings; my $fh = \*DATA; while (! eof $fh) { my @lines = map { <$fh> // () } 1..10; print "lines = " . @lines . "\n"; } __DATA__ line 1 line 2 line 3 line 4 line 5 line 6 line 7 line 8 line 9 line 10 line 11 line 12 line 13 line 14 line 15 line 16 line 17

Outputs:

lines = 10 lines = 7

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (5)
As of 2024-04-23 04:10 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found