Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
my $line_number = 16; my $count = 0; while(<DATA>){ chomp($_); $count++; next unless $count == $line_number; print "$_\n"; $count = 0; } __DATA__ 1 Bob 48 IT 2 David 26 IT 3 Jerry 22 IT 4 Josh 33 IT 5 Karl 35 IT 6 Dan 50 IT 7 Tom 26 IT 8 Randy 48 Engineering 9 Trevor 57 Engineering 10 Tony 48 Engineering 11 Larry 39 Engineering 12 Farhan 40 Engineering 13 Sandy 28 Engineering 14 Jessie 55 Engineering 15 Carl 25 Engineering 16 Donald 58 Engineering 17 Rick 44 Engineering 18 Barry 38 Engineering 19 Bruce 30 Engineering 20 Joe 37 Engineering 21 Mun 53 Engineering 22 Shiro 48 Engineering 23 Sally 50 HR 24 John 32 Finance
Perl Good - Manual process bad

In reply to Re: How to read every 16 line of file ? by monk2b
in thread How to read every 16 line of file ? by bh_perl

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (6)
As of 2022-06-29 00:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My most frequent journeys are powered by:









    Results (94 votes). Check out past polls.

    Notices?