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:
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";
$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.
Are you posting in the right place? Check out Where do I post X? to know for sure.
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
Want more info? How to link or
or How to display code and escape characters
are good places to start.