OOPS, I see that yr already identified this approach.

If your lines are really all the same length, you could do the job via a seek() / read() loop. The example below needs error checking. I haven't done any speed tests.

#!/usr/bin/perl use strict; use warnings; my $linesep_len = length($/); my $rec_len = length('ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA') + $li +nesep_len; my $read_len = 1; my $skip_len = $rec_len - $read_len; binmode(DATA); seek(DATA, 10, 1) or die "seek error"; my $buf = ' ' x $read_len; while (read(DATA, $buf, $read_len) > 0) { print $buf, "\n"; seek(DATA, $skip_len, 1) or last; } __DATA__ ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA ACATCACCTCxCACAACGAGGACTACACCATCGTGGAACA ACATCACCTCsCACAACGAGGACTACACCATCGTGGAACA ACATCACCTCjCACAACGAGGACTACACCATCGTGGAACA ACATCACCTCcCACAACGAGGACTACACCATCGTGGAACA ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA ACATCACCTCCCACAACGAGGACTACACCATCGTGGAACA ACATCACCTC-CACAACGAGGACTACACCATCGTGGAACA
Output:
C x s j c C C C C -

In reply to Re: Faster and more efficient way to read a file vertically by wazat
in thread Faster and more efficient way to read a file vertically by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.