I have been running this particular script as a cron job for about 3 months now. The general concept of what it does is:
1) do some stuff that is unimportant and populates arrays
2) at one point it splits up a csv string (on the comma of course) and puts that into a temp array
3) then strip off the quotes that are around that first position and set that as a filename.
My code looked like this:
$tempArray[0] =~ s/\"//g; ;
$fileName = $tempArray[0];
And for months it worked. (notice the double ";" in the first line - I apparently didn't notice that)
Then today it iterated through nearly 2 times as much data as it had to in the past, and it died in an odd way.
It expects the data to always be all caps. It writes it that way, and the data source that we talk to also writes in all caps.
But today it died and when I started putting in print statements to trace the issue, it was because the last character of a string was lowercase.
so I changed the code above to this (which I should have done in the first place):
$tempArray[0] =~ s/\"//g; ;
$fileName = uc($tempArray[0]);
and it worked. Again - I didn't notice the extra ";" but it doesn't seem to care.
So... from that I have the following questions:
Why did it work for months and then fail today when it had to do more work? Was that unrelated? Why had it never failed in the past?
Also, is the extra ";" not an issue - I run it with perl -w and it didn't complain.
(and yes, I checked all of the places that it is getting the data from that it looks at - and they are all in caps. I had thought for sure that it was a slip up on the data provider's side and they just accidentally had a lowercase in there - but I looked with a raw nonautomated call to it and it was as it should be.)
is my code doing something outside of what I think it is.
I put in the trace statements and those were the two lines at which it broke - but not on the first instance either - it would run through about 20 iterations of the loop, and then always die at the same point.
I'm totally baffled on this one - I thought for sure it was just the data provider belching - but now I want to make sure it isn't my code.
does the extra ";" do something? and if so, what?