in reply to Re: Understanding variable scope in perl
in thread Understanding variable scope in perl

Ahh, after looking at my code for an hour straight (literally, my eyes stayed on the screen on my PowerBook without moving), I found my elusive bug. Guess what it was? Yep, I had used an '<=" instead of a '<' in my while loop all this code is in, causing my code to overshoot my 'protein_matrix' and throw undefined errors. This little bug has caused me like 3 days........grrrrrr You guys are great though. Thanks. I've learned a lot of valuable debugging routes from this thread... By the way: Does perl have exception handling?

**Special thanks to husker for introducing me to this online perl community**
  • Comment on Re^2: Understanding variable scope in perl

Replies are listed 'Best First'.
Re^3: Understanding variable scope in perl
by herveus (Prior) on Sep 30, 2005 at 01:07 UTC
    Howdy!

    Yep. Perl does exceptions.

    eval is the "try" part; checking $@ is the "catch". die is the "throw" bit.

    yours,
    Michael
      cool, thank. And liverpole: points well taken. thanks.
Re^3: Understanding variable scope in perl
by liverpole (Monsignor) on Sep 30, 2005 at 01:06 UTC
    Ouch!!

    Now you see why you've got to show ALL the code, lest the words "(all this is actually in a while loop not posted)" come back to sting you!

    A final point -- don't ever submit code that you need reviewed by typing it in by hand (as I think you may have done to convert the loop variable to an actual value).  Always cut and paste!  Otherwise, even if the error is somewhere within the submission, you may "mentally fix the error" when you type it in, and nobody else will ever see it.

    Good luck!