Dude! Further optimize! Let's see ...
elsif (/\*{4}stuff\*{4}(.*?)\*{4}endstuff\*{4}/sg; ) { push(@stuff, $_); } }
That's one.

A style issue here:

for (my $i=0; $i < (@filenames); $i++) { should be for my $i (0 ... $#filenames) {
Now. If you're running out of memory, have you tried running it with a smaller dataset and figuring out where the memory threshold is? I can tell you it's not in loading your script into RAM ... it's just not big enough. It's when you're building these datastructures. Try just one filename's worth. If that breaks stuff, start making it smaller. Don't bite off more than you can chew! If it's not working, simplify until it does, then build it up again.

------
/me wants to be the brightest bulb in the chandelier!

Vote paco for President!


In reply to Re: OUT OF MEMORY! by dragonchild
in thread OUT OF MEMORY! by maddfisherman

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.