First, kudos for using strict and warnings!

Addressing only the @dump issue mentioned...

You define @dump as a global variable. In the foreach $FileInDirectory(@FileInDirectory) { loop you add "\n\n" to @dump - that would be once per file. Then in the while (<SINGLE>) { loop you add $title and/or $point to @dump each time a line in the file matches the regex.

When you start processing the 2nd file, @dump still contains whatever it got from the 1st. 3rd file, 1st and 2nd, etc. You need to clear out @dump between files. You stated: If I clear the array at each time around, nothing of the list gets written to the OUTPUT. I suspect you added something like @dump = (); after the while (<SINGLE>) { line, clearing it before processing each line of the file. Then, since the last line of the file didn't match, @dump was empty. The fix is to clear the array once per file, not once per line.

. . .

OK, I can't resist this one. You open OUTPUT, print to it, and close it in the while loop. If the file being processed has 172 lines, you're creating that file 172 times.


In reply to Re: At it again... by keszler
in thread At it again... by sdyates

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.