in reply to At it again...
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.
|
|---|