As shown in your OP the for loop does nothing that takes any time at all (except maybe the diagnostic print). It is code you haven't shown us that is taking the time.

Don't hide code or information on your scratchpad that is pertinent to your question. That stuff won't be there in a couple of days so and your question becomes worthless to future perusers of SOPW. Maybe you don't care about that so long as you get the answer you need, but I suspect giving a little back to the community is something you'd be happy to do so please ensure all pertinent information is available in the OP (inside readmore tags if it's large).

True laziness is hard work

In reply to Re: Foreach loop takes a long time to process and my report times out before page is rendered by GrandFather
in thread Foreach loop takes a long time to process and my report times out before page is rendered by Lori713

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.