I am seeing an odd behavior here, which is making me assume at this point that something I thought I was doing properly is actually incorrect.

I have a directory A, in that directory are thousands of files that are in the name style of all caps letters. AAA, ABC, TTH, RTYU, etc (stock tickers).

I have a directory within that A directory that has files that are named exactly like the files in the directory above. But there is different information in there.
That data looks like:
H: 1.000000 B: 2,0,-1.57
My code is starting off and getting all of the filenames out of the subdir and populating an array. I have checked that visually and each spot is correct and there are no blank spots in there.

I iterate over that array and I open the file that matches that in the A directory. I put that into an array, and I then splice off parts of it, and then reverse that array.
All of that works perfectly over and over and over again for thousands of iterations.

But the instant I uncomment this code here that follows that code, it does something I've never seen before.
$strASub = ''; open(ASUBFILE,"/A/sub/$strTName") or die "can't open the asub file: $s +trTName : $!\n"; while(<ASUBFILE>){ $strASub .= $_; } close(ASUBFILE) or die "can't close the asub file: $strTName :$!\n";
Once that code is uncommented, then it fails. It will dump out something that clears my ssh screen and then a bunch of space, and then some other tickernames will show up separated by odd characters like superscript 1s and other things like that.

If I comment the code, then everything works out well - uncommented, crash. I can't trace down what file it doing it because it dies and clears the screen. I tried debugging it locally on my laptop, but I have some issues with this laptop where it will overheat and die easily.

Is that open call incorrect? Is there an easy way I could check over 1000 files to see if one has odd data in it that is causing this to break?
It looks like a similar issue to a buffer overflow.


-------------------------------------------------------------------
There are some odd things afoot now, in the Villa Straylight.

In reply to Strange crash - any ideas? by AssFace

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":