in reply to Case change... why did this happen?

I have to say, your post reads a little, let's say "illogically" to me.

First, you say you know why it failed, because there was a lowercase letter in a certain place -- that can't be the reason if it's your s/\"//g that causes the problem.

But later on you also say that you checked the data and it's "all in caps", so, that contradicts what you wrote earlier.

I say, if it ran through 20 iterations then died ("in a weird way"? What was the message in $!?) then I'd say it's an issue with your data on line 19.

Please post again in more detail and more broadly. You've posted that you have problem X, and the reason you've got it is Situation Y and can someone help with Situation Y -- but all you really know is that you've got problem X.
--
“Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.” M-J D

  • Comment on Re: Case change... why did this happen?

Replies are listed 'Best First'.
Re: Re: Case change... why did this happen?
by AssFace (Pilgrim) on Jan 23, 2003 at 01:24 UTC
    Okay - good point. I tend to ramble :)

    It doesn't some stuff that gets it started up (which is reading a stock ticker from a file - that stock ticker is all caps). Then it takes that ticker and hits the data feed over http, which then returns a single line of CSVs.
    The CVS line will look something like:
    "ABCD","10/19/2002",45.67,45.67,45.67,9999292922

    I want to get the first value out of there, and strip off the quotes. Then the value that is in there (that our data feed always has in all caps) is used to look up a local filename that matches that.

    The error I got after 20 iterations was showing that the data above (its equivalent) was returning "ABCd" and then when it went to lookup that filename - it wasn't finding it because the filename would be all uppercase.

    I immediately figured it was the datafeed that was screwing up, so I went in through a raw http session and not through the automated perl one and I called that ticker and it came back "ABCD"
    I then thought perhaps there was some weird thing that it just returned what you gave it, so perhaps it was getting butchered prior to that. I tried sending it a mixed case ticker, and it still returned "ABCD"
    I then thought perhaps my code was doing something screwy based on the original file that it was using to lookup via - but after looking, that too was all caps.

    So then I thought, well, perhaps it was a glitch in the data feed and now that I've been hitting it directly it seems to be working again. So I called my perl script again, and it died in the same place again, saying that the file it was looking for was "ABCd"

    I then started looking at that value higher up in the code, and it breaks at the two lines that I included in here with my question - hence why I'm baffled.

    And like I said, it was so bizarre and then I saw the double ; ; at the end of that line and I wondered if perhaps that somehow was something special that I was unaware of in Perl - it didn't make sense to me, but that isn't to say that all of Perl makes intuitive sense to me straight off as it is.

    was that a better explaination?
      It can't be that you get "ABCd" when it's "ABCD" that is there. Try again, and this time, let Perl help you debug it. Add code like:
      print "Oops, '$fileName' ne '\U$fileName\E' at line $." if $fileName n +e uc($fileName);
      Surely, it'll have to warn you at some point, otherwise using the uc() wouldn't make a difference.
      >was that a better explaination?

      Much better, but I'm still baffled.

      One thing -- you don't need to escape the quotes in your s/\"//g -- if that's something other than a quote, I guess something weird could be happening...

      OK get your script to print out like this:

      print "first item in the array is $myArray[0] \n"; print "doing the replace: \n"; if($myArray[0] =~ s/"//g){ print "it happened\n"; } else { print "nothing to replace, apparently\n"; } print "first item in the array is now $myArray[0] \n";

      and see what that says. It's either uppercase or lowercase, it can't be both...
      --
      “Every bit of code is either naturally related to the problem at hand, or else it's an accidental side effect of the fact that you happened to solve the problem using a digital computer.” M-J D