---------- Forwarded message ---------- From: Jefferson Kirkland <[EMAIL PROTECTED]> Date: Jun 18, 2007 10:45 AM Subject: Re: Why must I chomp a variable set in a script? (Problem Solved) To: Paul Lalli <[EMAIL PROTECTED]>
Paul, On 6/18/07, Paul Lalli <[EMAIL PROTECTED]> wrote:
On Jun 18, 8:48 am, [EMAIL PROTECTED] (Jefferson Kirkland) wrote: There's no reason, from what you've told us. chomp() would have no effect on that variable, as it doesn't end in a newline. My guess is that either you're leaving out an important detail for the sake of brevity, or your coworker changed something else too, but mistakenly believed it was the chomp() that solved the problem. Can you create a short-but-complete script that demonstrates the original failure, and then a version that has only the additional chomp() line inserted but suddenly works correctly? Also, what is meant by "it doesn't work" in your question? What did not work? How did it not work? What errors did you receive? Paul Lalli
Ok, in the past hour there have been some real revelations and learning on my part. I have made some people scratch their heads and then go "OOOOH!!!!". In the echo of their "OOOOH!!!!" was the explanation of my issue. What I didn't realize, was that when you are doing a test on a variable that contains a file name (a file test that is), you must first CLOSE THE FILE HANDLE! Talk about having to bang your head on the desk. I was closing the filehandle, but doing it after all was said and done with the loop. (sorry for that little missing detail). I will make sure next time to post the entire script so you can see everything that is going on. Thank you for the response Paul, I really appreciate it!! BTW, the chomp is no longer in the script as it didn't seem to resolve this issue after my writing. Not sure why, but that is an issue I don't have time to delve into right now. Its probably because it shouldn't have resolved it to begin with and something was more than likely modified in the process of debugging and also removed before I had the chance to see it and test it. Regards, Jeff Kirkland