I also fail to see obvious memory leak issues, so maybe it's time for some paranoia:
- use strict; use warnings;
- protect against pathologic filenames and use the 3 argument form of
open(UNMODIFIED,"<","$processedDirPath/$matchingFiles")
(good style, but unlikely to be the problem)
- my bet: add a size check like
-f "$processedDirPath/$matchingFiles" and -s _ < 40960 and
do{warn "size or type problem with $processedDirPath/$matchingFile
+s\n"; next};
- idle curiousity: there won't ever occur further STRUC20 alone or as part of something else after the first occurance?
cu & HTH, Peter -- hints may be untested unless stated otherwise; use with caution & understanding.
Update:
- what do you mean with print DATA!? These changes don't touch your copying loop at all.
- anyway, the size testing goes before your open() calls, that is: in the outer loop.
- btw, consider rename instead of mv.