Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: How to read every 16 line of file ?

by LanX (Sage)
on May 13, 2011 at 14:01 UTC ( #904676=note: print w/replies, xml ) Need Help??


in reply to How to read every 16 line of file ?

I think what you want is reading 16 lines in a gulp not every 16th line.

Cheers Rolf

UPDATE:

more explicit:

while ( @lines = readlines($filehandle,16) ) { print @lines,"----\n"; } sub readlines { my ($fh, $count) = @_; my @gulp; while (<$fh>) { push @gulp,$_; last unless --$count; } return @gulp; }

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2023-03-22 08:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Which type of climate do you prefer to live in?






    Results (60 votes). Check out past polls.

    Notices?