I posted something akin to this at the node entitled A very odd happening (at least to me).

Here I want to clarify my question. CAN anyone help me to try to make the code work quickly?

I've tried a plethora of techniques, and it seems nothing works. I have 27 folders each with 12 files in them that I want to process (600-2500 KB, most ~1500 KB). Now, I've stripped the code down to just reading in the file and running a few lines of code (details at aforementioned node)
(I've read the file into @lines)

for my $curline(@lines) { next unless (reverse $curline) =~ /^\s*([05])/; $zeroat[$i++] = $ln_num if $1 == 0; $ln_num++; } for $i(@zeroat) { $lines[$i] =~ /^([0-9]+.?[0-9]*)\t.*([05])\s*$/; if ($1 > .5 && $2 == 0) { splice @lines,$i,1; @lines1 = @lines; @lines2 = splice @lines1,$i,$#lines1-$i+1; } }

The code aside, though, it seems that just reading in these files takes too long. What can I do (do I need a faster computer, read line by line, optimize code, etc.)?


In reply to Processing large files many times over by dimmesdale

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.